nfsd4: permit layoutget of executable-only files

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/66282ec1cf004c09083c29cb5e49019037937bbd
Commit:     66282ec1cf004c09083c29cb5e49019037937bbd
Parent:     d9226ec9ef01832b1edc1781241920614c6407db
Refname:    refs/heads/master
Author:     Benjamin Coddington <[email protected]>
AuthorDate: Tue Dec 19 09:35:25 2017 -0500
Committer:  J. Bruce Fields <[email protected]>
CommitDate: Thu Dec 21 15:24:19 2017 -0500

    nfsd4: permit layoutget of executable-only files
    
    Clients must be able to read a file in order to execute it, and for pNFS
    that means the client needs to be able to perform a LAYOUTGET on the file.
    
    This behavior for executable-only files was added for OPEN in commit
    a043226bc140 "nfsd4: permit read opens of executable-only files".
    
    This fixes up xfstests generic/126 on block/scsi layouts.
    
    Signed-off-by: Benjamin Coddington <[email protected]>
    Signed-off-by: J. Bruce Fields <[email protected]>
---
 fs/nfsd/nfs4proc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 008ea0b627d0..effeeb4f556f 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1363,14 +1363,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
 	const struct nfsd4_layout_ops *ops;
 	struct nfs4_layout_stateid *ls;
 	__be32 nfserr;
-	int accmode;
+	int accmode = NFSD_MAY_READ_IF_EXEC;
 
 	switch (lgp->lg_seg.iomode) {
 	case IOMODE_READ:
-		accmode = NFSD_MAY_READ;
+		accmode |= NFSD_MAY_READ;
 		break;
 	case IOMODE_RW:
-		accmode = NFSD_MAY_READ | NFSD_MAY_WRITE;
+		accmode |= NFSD_MAY_READ | NFSD_MAY_WRITE;
 		break;
 	default:
 		dprintk("%s: invalid iomode %d\n",
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.