NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
Subsystems (2)
PATCH 1/1 NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
Commit 1ca843a2d2 "nfs: Fix GETATTR bitmap verification" has check the bitmap after decoding success, but decode_attr_fs_locations forgets cleanup the FATTR4_WORD0_FS_LOCATIONS bits.
decode_getfattr_attrs always return -EIO when meeting FS_LOCATIONS now.
# ll /mnt/ ls: cannot access /mnt/referal: Input/output error ls: cannot access /mnt/replicas: Input/output error total 32 drwxr-xr-x. 7 root root 8192 Nov 16 20:36 pnfs ??????????? ? ? ? ? ? referal ??????????? ? ? ? ? ? replicas
--- fs/nfs/nfs4xdr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4xdr.c +3 -1
@@ -3671,8 +3671,10 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, stif (unlikely (status !=0 )) goto out_eio; } -if (res->nlocations !=0 ) +if (res->nlocations !=0 ) { + bitmap[0 ] &= ~FATTR4_WORD0_FS_LOCATIONS ; status =NFS_ATTR_FATTR_V4_LOCATIONS ; + } out:dprintk ("%s: fs_locations done, error = %d\n" , __func__, status);return status;
Signature · 1 line
2.5.0
From: Kinglong Mee <[email protected]>
Kinglong,
Quoted 6 lines · Kinglong Mee
Commit
1ca843a2d2"nfs: Fix GETATTR bitmap verification" has check the bitmap after decoding success, butdecode_attr_fs_locationsforgets cleanup theFATTR4_WORD0_FS_LOCATIONSbits.
decode_getfattr_attrsalways return-EIOwhen meetingFS_LOCATIONSnow.
Quoted 8 lines
ls: cannot access
/mnt/referal: Input/output error
ls: cannot access/mnt/replicas: Input/output error total 32
drwxr-xr-x. 7 root root 8192 Nov 16 20:36 pnfs??????????? ? ? ? ? ? referal ??????????? ? ? ? ? ? replicasSigned-off-by Kinglong Mee <[email protected]>
this looks like the right kind of fix, I think we can clear the bit earlier in decode_attr_fs_locations though, as below.
Thanks,
Andreas
--- fs/nfs/nfs4xdr.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/nfs4xdr.c +1 -0
@@ -3637,6 +3637,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st status =0 ;if (unlikely (!(bitmap[0 ] &FATTR4_WORD0_FS_LOCATIONS ))) goto out; + bitmap[0 ] &= ~FATTR4_WORD0_FS_LOCATIONS ; status = -EIO ;/* Ignore borken servers that return unrequested attrs */ if (unlikely (res ==NULL ))
Signature · 1 line
2.5.0
PATCH v2 1/1 NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
Commit 1ca843a2d2 "nfs: Fix GETATTR bitmap verification" has check the bitmap after decoding success, but decode_attr_fs_locations forgets cleanup the FATTR4_WORD0_FS_LOCATIONS bits.
decode_getfattr_attrs always return -EIO when meeting FS_LOCATIONS now.
ls: cannot access /mnt/referal: Input/output error
ls: cannot access /mnt/replicas: Input/output error total 32
drwxr-xr-x. 7 root root 8192 Nov 16 20:36 pnfs
??????????? ? ? ? ? ? referal ??????????? ? ? ? ? ? replicas
v2: clear the bit earlier
--- fs/nfs/nfs4xdr.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/nfs4xdr.c +1 -0
@@ -3615,6 +3615,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st status =0 ;if (unlikely (!(bitmap[0 ] &FATTR4_WORD0_FS_LOCATIONS ))) goto out; + bitmap[0 ] &= ~FATTR4_WORD0_FS_LOCATIONS ; status = -EIO ;/* Ignore borken servers that return unrequested attrs */ if (unlikely (res ==NULL ))
Signature · 1 line
2.5.0