fs: encode_fh: return FILEID_INVALID if invalid fid_type
Subsystems (14)
PATCH 1/1 fs: encode_fh: return FILEID_INVALID if invalid fid_type
This patch is a follow up on below patch:
[PATCH] exportfs: add FILEID_INVALID to indicate invalid fid_type
https://patchwork.kernel.org/patch/1385131/
Signed-off-by Namjae Jeon <[email protected]>
Signed-off-by Vivek Trivedi <[email protected]>
--- fs/btrfs/export.c | 4 ++-- fs/ceph/export.c | 4 ++-- fs/fuse/inode.c | 2 +- fs/gfs2/export.c | 4 ++-- fs/isofs/export.c | 4 ++-- fs/nilfs2/namei.c | 4 ++-- fs/ocfs2/export.c | 4 ++-- fs/reiserfs/inode.c | 4 ++-- fs/udf/namei.c | 4 ++-- fs/xfs/xfs_export.c | 4 ++-- mm/cleancache.c | 2 +- mm/shmem.c | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-)
fs/btrfs/export.c +2 -2
@@ -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 ;
fs/ceph/export.c +2 -2
@@ -79,7 +79,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);
@@ -88,7 +88,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, } }else { *max_len = handle_length; - type =255 ; + type =FILEID_INVALID ; }return type; }
fs/fuse/inode.c +1 -1
@@ -672,7 +672,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;
fs/gfs2/export.c +2 -2
@@ -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 );
fs/isofs/export.c +2 -2
@@ -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 ;
fs/nilfs2/namei.c +2 -2
@@ -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;
fs/ocfs2/export.c +2 -2
@@ -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; }
fs/reiserfs/inode.c +2 -2
@@ -1599,10 +1599,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;
fs/udf/namei.c +2 -2
@@ -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 ;
fs/xfs/xfs_export.c +2 -2
@@ -47,7 +47,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 ;/* invalid */ }STATIC int
@@ -89,7 +89,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;
mm/cleancache.c +1 -1
@@ -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 ;
mm/shmem.c +1 -1
@@ -2386,7 +2386,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)) {
Signature · 1 line
1.7.9.5
Hi,
Quoted 7 lines · Namjae Jeon
This patch is a follow up on below patch:
[PATCH] exportfs: add
FILEID_INVALIDto indicate invalidfid_type
https://patchwork.kernel.org/patch/1385131/Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Vivek Trivedi <[email protected]>
for the gfs2 bits,
Steve.
Quoted 219 lines
--- fs/btrfs/export.c | 4 ++-- fs/ceph/export.c | 4 ++-- fs/fuse/inode.c | 2 +- fs/gfs2/export.c | 4 ++-- fs/isofs/export.c | 4 ++-- fs/nilfs2/namei.c | 4 ++-- fs/ocfs2/export.c | 4 ++-- fs/reiserfs/inode.c | 4 ++-- fs/udf/namei.c | 4 ++-- fs/xfs/xfs_export.c | 4 ++-- mm/cleancache.c | 2 +- mm/shmem.c | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-)fs/btrfs/export.c +2
-2@@ -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 ;fs/ceph/export.c +2
-2@@ -79,7 +79,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);@@ -88,7 +88,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, } }else { *max_len = handle_length; - type =255 ; + type =FILEID_INVALID ; }return type; }fs/fuse/inode.c +1
-1@@ -672,7 +672,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;fs/gfs2/export.c +2
-2@@ -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 );fs/isofs/export.c +2
-2@@ -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 ;fs/nilfs2/namei.c +2
-2@@ -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;fs/ocfs2/export.c +2
-2@@ -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; }fs/reiserfs/inode.c +2
-2@@ -1599,10 +1599,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;fs/udf/namei.c +2
-2@@ -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 ;fs/xfs/xfs_export.c +2
-2@@ -47,7 +47,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 ;/* invalid */ }STATIC int@@ -89,7 +89,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;mm/cleancache.c +1
-1@@ -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 ;mm/shmem.c +1
-1@@ -2386,7 +2386,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)) {