fs: encode_fh: return FILEID_INVALID if invalid fid_type
authorNamjae Jeon <namjae.jeon@samsung.com>
Sun, 17 Feb 2013 06:48:11 +0000 (15:48 +0900)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 26 Feb 2013 07:46:10 +0000 (02:46 -0500)
This patch is a follow up on below patch:

[PATCH] exportfs: add FILEID_INVALID to indicate invalid fid_type
commit: 216b6cbdcbd86b1db0754d58886b466ae31f5a63

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: Sage Weil <sage@inktank.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 files changed:
fs/btrfs/export.c
fs/ceph/export.c
fs/fuse/inode.c
fs/gfs2/export.c
fs/isofs/export.c
fs/nilfs2/namei.c
fs/ocfs2/export.c
fs/reiserfs/inode.c
fs/udf/namei.c
fs/xfs/xfs_export.c
mm/cleancache.c
mm/shmem.c

index 614f34a899c2db468792f1ef8406c5a366739258..81ee29eeb7ca569dd53bea2b35789c1fe9c2c777 100644 (file)
@@ -22,10 +22,10 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
 
        if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) {
                *max_len = BTRFS_FID_SIZE_CONNECTABLE;
-               return 255;
+               return FILEID_INVALID;
        } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) {
                *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE;
-               return 255;
+               return FILEID_INVALID;
        }
 
        len  = BTRFS_FID_SIZE_NON_CONNECTABLE;
index ca3ab3f9ca70d87c6ab3a421c1e366b5b0d0fdbd..16796be53ca59450ebc81a074c84e7e08955a71b 100644 (file)
@@ -81,7 +81,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
                if (parent_inode) {
                        /* nfsd wants connectable */
                        *max_len = connected_handle_length;
-                       type = 255;
+                       type = FILEID_INVALID;
                } else {
                        dout("encode_fh %p\n", dentry);
                        fh->ino = ceph_ino(inode);
@@ -90,7 +90,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
                }
        } else {
                *max_len = handle_length;
-               type = 255;
+               type = FILEID_INVALID;
        }
        if (dentry)
                dput(dentry);
index 73ca6b72beafa0d19f5997bf7627b5046459c492..b730fda9aa4c4324fb45deed644d4646ba183026 100644 (file)
@@ -678,7 +678,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
 
        if (*max_len < len) {
                *max_len = len;
-               return  255;
+               return  FILEID_INVALID;
        }
 
        nodeid = get_fuse_inode(inode)->nodeid;
index 4767774a5f3e7d9c61b5f6ac67571bd450b331ee..9973df4ff565b6642247e44f854307a0d696f06a 100644 (file)
@@ -37,10 +37,10 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len,
 
        if (parent && (*len < GFS2_LARGE_FH_SIZE)) {
                *len = GFS2_LARGE_FH_SIZE;
-               return 255;
+               return FILEID_INVALID;
        } else if (*len < GFS2_SMALL_FH_SIZE) {
                *len = GFS2_SMALL_FH_SIZE;
-               return 255;
+               return FILEID_INVALID;
        }
 
        fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32);
index 2b4f2358eadbb063fab1fb2c275e9cad1151bd6c..12088d8de3faa1984fa88db3228dfcf669bb1539 100644 (file)
@@ -125,10 +125,10 @@ isofs_export_encode_fh(struct inode *inode,
         */
        if (parent && (len < 5)) {
                *max_len = 5;
-               return 255;
+               return FILEID_INVALID;
        } else if (len < 3) {
                *max_len = 3;
-               return 255;
+               return FILEID_INVALID;
        }
 
        len = 3;
index 1d0c0b84c5a319e61e24f04f3d643f9284b6cee6..9de78f08989edcd9ab0dc18b3aaca3a65535f11a 100644 (file)
@@ -517,11 +517,11 @@ static int nilfs_encode_fh(struct inode *inode, __u32 *fh, int *lenp,
 
        if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) {
                *lenp = NILFS_FID_SIZE_CONNECTABLE;
-               return 255;
+               return FILEID_INVALID;
        }
        if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) {
                *lenp = NILFS_FID_SIZE_NON_CONNECTABLE;
-               return 255;
+               return FILEID_INVALID;
        }
 
        fid->cno = root->cno;
index 322216a5f0dd1e0f2e178540781b3c6fd263c985..29651167190dd15032a5aaa71d2fe066a7bbab97 100644 (file)
@@ -195,11 +195,11 @@ static int ocfs2_encode_fh(struct inode *inode, u32 *fh_in, int *max_len,
 
        if (parent && (len < 6)) {
                *max_len = 6;
-               type = 255;
+               type = FILEID_INVALID;
                goto bail;
        } else if (len < 3) {
                *max_len = 3;
-               type = 255;
+               type = FILEID_INVALID;
                goto bail;
        }
 
index 95d7680ead47a8c6379629614eadb0fdbf233fe0..ea5061fd4f3e04b055421c1d8d6c5657d250e758 100644 (file)
@@ -1603,10 +1603,10 @@ int reiserfs_encode_fh(struct inode *inode, __u32 * data, int *lenp,
 
        if (parent && (maxlen < 5)) {
                *lenp = 5;
-               return 255;
+               return FILEID_INVALID;
        } else if (maxlen < 3) {
                *lenp = 3;
-               return 255;
+               return FILEID_INVALID;
        }
 
        data[0] = inode->i_ino;
index 95fee278ab9da660608226b478645878424bbf64..102c072c6bbfed3d76541b2c3766d89c9272d2ca 100644 (file)
@@ -1270,10 +1270,10 @@ static int udf_encode_fh(struct inode *inode, __u32 *fh, int *lenp,
 
        if (parent && (len < 5)) {
                *lenp = 5;
-               return 255;
+               return FILEID_INVALID;
        } else if (len < 3) {
                *lenp = 3;
-               return 255;
+               return FILEID_INVALID;
        }
 
        *lenp = 3;
index a83611849cee292d6731d8a782778d6ebb2bf048..c585bc646395e04c5497621eeb4ec34bd1f262e7 100644 (file)
@@ -48,7 +48,7 @@ static int xfs_fileid_length(int fileid_type)
        case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
                return 6;
        }
-       return 255; /* invalid */
+       return FILEID_INVALID;
 }
 
 STATIC int
@@ -90,7 +90,7 @@ xfs_fs_encode_fh(
        len = xfs_fileid_length(fileid_type);
        if (*max_len < len) {
                *max_len = len;
-               return 255;
+               return FILEID_INVALID;
        }
        *max_len = len;
 
index 32e6f4136fa2297e13a6ac51444d50c18b78e9a3..d76ba74be2d04dea9bcc2828f42e1ce10be6ad0e 100644 (file)
@@ -89,7 +89,7 @@ static int cleancache_get_key(struct inode *inode,
                fhfn = sb->s_export_op->encode_fh;
                if  (fhfn) {
                        len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL);
-                       if (len <= 0 || len == 255)
+                       if (len <= FILEID_ROOT || len == FILEID_INVALID)
                                return -1;
                        if (maxlen > CLEANCACHE_KEY_MAX)
                                return -1;
index 25cd688bd208455b463eaeff877342fea92ae029..320ffc1d1d1eb1e0c78ab205ab86181bdc93c75d 100644 (file)
@@ -2351,7 +2351,7 @@ static int shmem_encode_fh(struct inode *inode, __u32 *fh, int *len,
 {
        if (*len < 3) {
                *len = 3;
-               return 255;
+               return FILEID_INVALID;
        }
 
        if (inode_unhashed(inode)) {