All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
@ 2015-11-17  3:44 Kinglong Mee
  2015-11-17  9:12 ` Andreas Gruenbacher
  0 siblings, 1 reply; 3+ messages in thread
From: Kinglong Mee @ 2015-11-17  3:44 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs, Andreas Gruenbacher, kinglongmee

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

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/nfs4xdr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index dfed4f5..f9f9d94 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3671,8 +3671,10 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
 		if (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;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
  2015-11-17  3:44 [PATCH] NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success Kinglong Mee
@ 2015-11-17  9:12 ` Andreas Gruenbacher
  2015-11-18  2:39   ` [PATCH v2] " Kinglong Mee
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Gruenbacher @ 2015-11-17  9:12 UTC (permalink / raw)
  To: Kinglong Mee, Trond Myklebust; +Cc: linux-nfs

From: Kinglong Mee <kinglongmee@gmail.com>

Kinglong,

On Tue, Nov 17, 2015 at 4:44 AM, Kinglong Mee <kinglongmee@gmail.com> wrote:
> 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
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>

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(+)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6779feb..55b4493 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -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))
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success
  2015-11-17  9:12 ` Andreas Gruenbacher
@ 2015-11-18  2:39   ` Kinglong Mee
  0 siblings, 0 replies; 3+ messages in thread
From: Kinglong Mee @ 2015-11-18  2:39 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andreas Gruenbacher, linux-nfs, kinglongmee

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

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/nfs4xdr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index dfed4f5..4e44412 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -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))
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-18  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-17  3:44 [PATCH] NFS4: Cleanup FATTR4_WORD0_FS_LOCATIONS after decoding success Kinglong Mee
2015-11-17  9:12 ` Andreas Gruenbacher
2015-11-18  2:39   ` [PATCH v2] " Kinglong Mee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.