[PATCH 1/1] pnfsd: fix ex_pnfs check_export bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andy Adamson <andros@xxxxxxxxxx>

Export option strings are not guaranteed to be present in every call to
svc_export_parse. For example, nfs-utils-1.1.2 exportfs validates the export
with a test call that does not include the 'pnfs' export option even though
it is set in /etc/exports.

nfsd4_layout_verify() checks if ex_pnfs is set so the ex_pnfs check in
check_export is not needed.

Furthermore,the pnfs_export_operations super block pointer should not be
changed because a) it is a const and b) the exports options can be changed
while the file system is mounted.

Remove the ex_pnfs check from check_export to prevent the pnfs_export_operations
superblock pointer from being set to NULL.

Signed-off-by: Andy Adamson <andros@xxxxxxxxxx>
---
 fs/nfsd/export.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index ddd12d8..8243f2d 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -382,8 +382,7 @@ static struct svc_export *svc_export_update(struct svc_export *new,
 					    struct svc_export *old);
 static struct svc_export *svc_export_lookup(struct svc_export *);
 
-static int check_export(struct inode *inode, int flags, unsigned char *uuid,
-			bool ex_pnfs)
+static int check_export(struct inode *inode, int flags, unsigned char *uuid)
 {
 
 	/* We currently export only dirs and regular files.
@@ -413,14 +412,6 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid,
 		return -EINVAL;
 	}
 
-	dprintk("%s: s_pnfs_op %p ex_pnfs %d\n", __func__,
-		inode->i_sb->s_pnfs_op, ex_pnfs);
-
-	if (!ex_pnfs) {
-		inode->i_sb->s_pnfs_op = NULL;
-		return 0;
-	}
-
 	if (inode->i_sb->s_pnfs_op &&
 	    (!inode->i_sb->s_pnfs_op->layout_type ||
 	     !inode->i_sb->s_pnfs_op->get_device_info ||
@@ -635,7 +626,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
 		}
 
 		err = check_export(exp.ex_path.dentry->d_inode, exp.ex_flags,
-				   exp.ex_uuid, exp.ex_pnfs);
+				   exp.ex_uuid);
 		if (err)
 			goto out4;
 	}
@@ -1077,7 +1068,7 @@ exp_export(struct nfsctl_export *nxp)
 		goto finish;
 	}
 
-	err = check_export(path.dentry->d_inode, nxp->ex_flags, NULL, false);
+	err = check_export(path.dentry->d_inode, nxp->ex_flags, NULL);
 	if (err) goto finish;
 
 	err = -ENOMEM;
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux