mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
NFSv4.2: SETXATTR should update ctime
Otherwise, `stat` will report a stale value to users. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
committed by
Trond Myklebust
parent
64edd55d0f
commit
86e2e1f6d9
@@ -1190,15 +1190,19 @@ static int _nfs42_proc_setxattr(struct inode *inode, const char *name,
|
|||||||
const void *buf, size_t buflen, int flags)
|
const void *buf, size_t buflen, int flags)
|
||||||
{
|
{
|
||||||
struct nfs_server *server = NFS_SERVER(inode);
|
struct nfs_server *server = NFS_SERVER(inode);
|
||||||
|
__u32 bitmask[NFS_BITMASK_SZ];
|
||||||
struct page *pages[NFS4XATTR_MAXPAGES];
|
struct page *pages[NFS4XATTR_MAXPAGES];
|
||||||
struct nfs42_setxattrargs arg = {
|
struct nfs42_setxattrargs arg = {
|
||||||
.fh = NFS_FH(inode),
|
.fh = NFS_FH(inode),
|
||||||
|
.bitmask = bitmask,
|
||||||
.xattr_pages = pages,
|
.xattr_pages = pages,
|
||||||
.xattr_len = buflen,
|
.xattr_len = buflen,
|
||||||
.xattr_name = name,
|
.xattr_name = name,
|
||||||
.xattr_flags = flags,
|
.xattr_flags = flags,
|
||||||
};
|
};
|
||||||
struct nfs42_setxattrres res;
|
struct nfs42_setxattrres res = {
|
||||||
|
.server = server,
|
||||||
|
};
|
||||||
struct rpc_message msg = {
|
struct rpc_message msg = {
|
||||||
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETXATTR],
|
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETXATTR],
|
||||||
.rpc_argp = &arg,
|
.rpc_argp = &arg,
|
||||||
@@ -1210,13 +1214,22 @@ static int _nfs42_proc_setxattr(struct inode *inode, const char *name,
|
|||||||
if (buflen > server->sxasize)
|
if (buflen > server->sxasize)
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
|
res.fattr = nfs_alloc_fattr();
|
||||||
|
if (!res.fattr)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
if (buflen > 0) {
|
if (buflen > 0) {
|
||||||
np = nfs4_buf_to_pages_noslab(buf, buflen, arg.xattr_pages);
|
np = nfs4_buf_to_pages_noslab(buf, buflen, arg.xattr_pages);
|
||||||
if (np < 0)
|
if (np < 0) {
|
||||||
return np;
|
ret = np;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
np = 0;
|
np = 0;
|
||||||
|
|
||||||
|
nfs4_bitmask_set(bitmask, server->cache_consistency_bitmask,
|
||||||
|
inode, NFS_INO_INVALID_CHANGE);
|
||||||
|
|
||||||
ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args,
|
ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args,
|
||||||
&res.seq_res, 1);
|
&res.seq_res, 1);
|
||||||
trace_nfs4_setxattr(inode, name, ret);
|
trace_nfs4_setxattr(inode, name, ret);
|
||||||
@@ -1224,9 +1237,13 @@ static int _nfs42_proc_setxattr(struct inode *inode, const char *name,
|
|||||||
for (; np > 0; np--)
|
for (; np > 0; np--)
|
||||||
put_page(pages[np - 1]);
|
put_page(pages[np - 1]);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
nfs4_update_changeattr(inode, &res.cinfo, timestamp, 0);
|
nfs4_update_changeattr(inode, &res.cinfo, timestamp, 0);
|
||||||
|
ret = nfs_post_op_update_inode(inode, res.fattr);
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
kfree(res.fattr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -212,11 +212,13 @@
|
|||||||
#define NFS4_enc_setxattr_sz (compound_encode_hdr_maxsz + \
|
#define NFS4_enc_setxattr_sz (compound_encode_hdr_maxsz + \
|
||||||
encode_sequence_maxsz + \
|
encode_sequence_maxsz + \
|
||||||
encode_putfh_maxsz + \
|
encode_putfh_maxsz + \
|
||||||
encode_setxattr_maxsz)
|
encode_setxattr_maxsz + \
|
||||||
|
encode_getattr_maxsz)
|
||||||
#define NFS4_dec_setxattr_sz (compound_decode_hdr_maxsz + \
|
#define NFS4_dec_setxattr_sz (compound_decode_hdr_maxsz + \
|
||||||
decode_sequence_maxsz + \
|
decode_sequence_maxsz + \
|
||||||
decode_putfh_maxsz + \
|
decode_putfh_maxsz + \
|
||||||
decode_setxattr_maxsz)
|
decode_setxattr_maxsz + \
|
||||||
|
decode_getattr_maxsz)
|
||||||
#define NFS4_enc_listxattrs_sz (compound_encode_hdr_maxsz + \
|
#define NFS4_enc_listxattrs_sz (compound_encode_hdr_maxsz + \
|
||||||
encode_sequence_maxsz + \
|
encode_sequence_maxsz + \
|
||||||
encode_putfh_maxsz + \
|
encode_putfh_maxsz + \
|
||||||
@@ -720,6 +722,7 @@ static void nfs4_xdr_enc_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
|
|||||||
encode_sequence(xdr, &args->seq_args, &hdr);
|
encode_sequence(xdr, &args->seq_args, &hdr);
|
||||||
encode_putfh(xdr, args->fh, &hdr);
|
encode_putfh(xdr, args->fh, &hdr);
|
||||||
encode_setxattr(xdr, args, &hdr);
|
encode_setxattr(xdr, args, &hdr);
|
||||||
|
encode_getfattr(xdr, args->bitmask, &hdr);
|
||||||
encode_nops(&hdr);
|
encode_nops(&hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1579,8 +1582,10 @@ static int nfs4_xdr_dec_setxattr(struct rpc_rqst *req, struct xdr_stream *xdr,
|
|||||||
status = decode_putfh(xdr);
|
status = decode_putfh(xdr);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
status = decode_setxattr(xdr, &res->cinfo);
|
status = decode_setxattr(xdr, &res->cinfo);
|
||||||
|
if (status)
|
||||||
|
goto out;
|
||||||
|
status = decode_getfattr(xdr, res->fattr, res->server);
|
||||||
out:
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@@ -1528,6 +1528,7 @@ struct nfs42_seek_res {
|
|||||||
struct nfs42_setxattrargs {
|
struct nfs42_setxattrargs {
|
||||||
struct nfs4_sequence_args seq_args;
|
struct nfs4_sequence_args seq_args;
|
||||||
struct nfs_fh *fh;
|
struct nfs_fh *fh;
|
||||||
|
const u32 *bitmask;
|
||||||
const char *xattr_name;
|
const char *xattr_name;
|
||||||
u32 xattr_flags;
|
u32 xattr_flags;
|
||||||
size_t xattr_len;
|
size_t xattr_len;
|
||||||
@@ -1537,6 +1538,8 @@ struct nfs42_setxattrargs {
|
|||||||
struct nfs42_setxattrres {
|
struct nfs42_setxattrres {
|
||||||
struct nfs4_sequence_res seq_res;
|
struct nfs4_sequence_res seq_res;
|
||||||
struct nfs4_change_info cinfo;
|
struct nfs4_change_info cinfo;
|
||||||
|
struct nfs_fattr *fattr;
|
||||||
|
const struct nfs_server *server;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nfs42_getxattrargs {
|
struct nfs42_getxattrargs {
|
||||||
|
Reference in New Issue
Block a user