aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-03-01 17:02:05 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-02 17:18:10 -0500
commit264e6351c59d22303582c45d79f0a5735f51d8d1 (patch)
treee1e15aa257b54fc890d94eb4f874ab0606ac371c
parent81934ddb8eb62a85b8015c0f2b824a88510965a2 (diff)
NFS: Request fh_expire_type attribute in "server caps" operation
The fh_expire_type file attribute is a filesystem wide attribute that consists of flags that indicate what characteristics file handles on this FSID have. Our client doesn't support volatile file handles. It should find out early (say, at mount time) whether the server is going to play shenanighans with file handles during a migration. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c1
-rw-r--r--fs/nfs/nfs4xdr.c26
-rw-r--r--include/linux/nfs_fs_sb.h3
-rw-r--r--include/linux/nfs_xdr.h1
4 files changed, 31 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 281c2def2b19..87b9b91f76cf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2220,6 +2220,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
2220 server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE; 2220 server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE;
2221 server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; 2221 server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
2222 server->acl_bitmask = res.acl_bitmask; 2222 server->acl_bitmask = res.acl_bitmask;
2223 server->fh_expire_type = res.fh_expire_type;
2223 } 2224 }
2224 2225
2225 return status; 2226 return status;
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index a6fb55da874c..3e0fe9f92e7c 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2676,6 +2676,7 @@ static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
2676 encode_sequence(xdr, &args->seq_args, &hdr); 2676 encode_sequence(xdr, &args->seq_args, &hdr);
2677 encode_putfh(xdr, args->fhandle, &hdr); 2677 encode_putfh(xdr, args->fhandle, &hdr);
2678 encode_getattr_one(xdr, FATTR4_WORD0_SUPPORTED_ATTRS| 2678 encode_getattr_one(xdr, FATTR4_WORD0_SUPPORTED_ATTRS|
2679 FATTR4_WORD0_FH_EXPIRE_TYPE|
2679 FATTR4_WORD0_LINK_SUPPORT| 2680 FATTR4_WORD0_LINK_SUPPORT|
2680 FATTR4_WORD0_SYMLINK_SUPPORT| 2681 FATTR4_WORD0_SYMLINK_SUPPORT|
2681 FATTR4_WORD0_ACLSUPPORT, &hdr); 2682 FATTR4_WORD0_ACLSUPPORT, &hdr);
@@ -3223,6 +3224,28 @@ out_overflow:
3223 return -EIO; 3224 return -EIO;
3224} 3225}
3225 3226
3227static int decode_attr_fh_expire_type(struct xdr_stream *xdr,
3228 uint32_t *bitmap, uint32_t *type)
3229{
3230 __be32 *p;
3231
3232 *type = 0;
3233 if (unlikely(bitmap[0] & (FATTR4_WORD0_FH_EXPIRE_TYPE - 1U)))
3234 return -EIO;
3235 if (likely(bitmap[0] & FATTR4_WORD0_FH_EXPIRE_TYPE)) {
3236 p = xdr_inline_decode(xdr, 4);
3237 if (unlikely(!p))
3238 goto out_overflow;
3239 *type = be32_to_cpup(p);
3240 bitmap[0] &= ~FATTR4_WORD0_FH_EXPIRE_TYPE;
3241 }
3242 dprintk("%s: expire type=0x%x\n", __func__, *type);
3243 return 0;
3244out_overflow:
3245 print_overflow_msg(__func__, xdr);
3246 return -EIO;
3247}
3248
3226static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) 3249static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change)
3227{ 3250{
3228 __be32 *p; 3251 __be32 *p;
@@ -4271,6 +4294,9 @@ static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_re
4271 goto xdr_error; 4294 goto xdr_error;
4272 if ((status = decode_attr_supported(xdr, bitmap, res->attr_bitmask)) != 0) 4295 if ((status = decode_attr_supported(xdr, bitmap, res->attr_bitmask)) != 0)
4273 goto xdr_error; 4296 goto xdr_error;
4297 if ((status = decode_attr_fh_expire_type(xdr, bitmap,
4298 &res->fh_expire_type)) != 0)
4299 goto xdr_error;
4274 if ((status = decode_attr_link_support(xdr, bitmap, &res->has_links)) != 0) 4300 if ((status = decode_attr_link_support(xdr, bitmap, &res->has_links)) != 0)
4275 goto xdr_error; 4301 goto xdr_error;
4276 if ((status = decode_attr_symlink_support(xdr, bitmap, &res->has_symlinks)) != 0) 4302 if ((status = decode_attr_symlink_support(xdr, bitmap, &res->has_symlinks)) != 0)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 03d0b91c2d5b..7073fc74481c 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -148,6 +148,9 @@ struct nfs_server {
148 u32 acl_bitmask; /* V4 bitmask representing the ACEs 148 u32 acl_bitmask; /* V4 bitmask representing the ACEs
149 that are supported on this 149 that are supported on this
150 filesystem */ 150 filesystem */
151 u32 fh_expire_type; /* V4 bitmask representing file
152 handle volatility type for
153 this filesystem */
151 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ 154 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
152 struct rpc_wait_queue roc_rpcwaitq; 155 struct rpc_wait_queue roc_rpcwaitq;
153 void *pnfs_ld_data; /* per mount point data */ 156 void *pnfs_ld_data; /* per mount point data */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 210da5dc4f17..6f4c35941965 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -977,6 +977,7 @@ struct nfs4_server_caps_res {
977 u32 acl_bitmask; 977 u32 acl_bitmask;
978 u32 has_links; 978 u32 has_links;
979 u32 has_symlinks; 979 u32 has_symlinks;
980 u32 fh_expire_type;
980 struct nfs4_sequence_res seq_res; 981 struct nfs4_sequence_res seq_res;
981}; 982};
982 983