diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2025-09-05 10:30:37 -0400 |
|---|---|---|
| committer | Chuck Lever <chuck.lever@oracle.com> | 2025-10-01 15:54:01 -0400 |
| commit | d6e80d48f9c83fc766c1418c584dbba5a0bc9e8a (patch) | |
| tree | cf96b7231c3d4f70661612870826bf797b334043 /fs/nfsd/blocklayout.c | |
| parent | eafdd7e949bb412bb6daa1f8c71b61d11c23ca5f (diff) | |
| download | linux-next-d6e80d48f9c83fc766c1418c584dbba5a0bc9e8a.tar.gz linux-next-d6e80d48f9c83fc766c1418c584dbba5a0bc9e8a.zip | |
NFSD: Do the grace period check in ->proc_layoutget
RFC 8881 Section 18.43.3 states:
> If the metadata server is in a grace period, and does not persist
> layouts and device ID to device address mappings, then it MUST
> return NFS4ERR_GRACE (see Section 8.4.2.1).
Jeff observed that this suggests the grace period check is better
done by the individual layout type implementations, because checking
for the server grace period is unnecessary for some layout types.
Suggested-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/linux-nfs/7h5p5ktyptyt37u6jhpbjfd5u6tg44lriqkdc7iz7czeeabrvo@ijgxz27dw4sg/T/#t
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/blocklayout.c')
| -rw-r--r-- | fs/nfsd/blocklayout.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index 0822d8a119c6..fde5539cf6a6 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -18,8 +18,8 @@ static __be32 -nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, - struct nfsd4_layoutget *args) +nfsd4_block_proc_layoutget(struct svc_rqst *rqstp, struct inode *inode, + const struct svc_fh *fhp, struct nfsd4_layoutget *args) { struct nfsd4_layout_seg *seg = &args->lg_seg; struct super_block *sb = inode->i_sb; @@ -29,6 +29,9 @@ nfsd4_block_proc_layoutget(struct inode *inode, const struct svc_fh *fhp, u32 device_generation = 0; int error; + if (locks_in_grace(SVC_NET(rqstp))) + return nfserr_grace; + if (seg->offset & (block_size - 1)) { dprintk("pnfsd: I/O misaligned\n"); goto out_layoutunavailable; |
