linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSD: only support readonly export for !fsync and readonly filesystem
@ 2016-12-31 13:18 Kinglong Mee
  2017-01-04 17:29 ` J. Bruce Fields
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kinglong Mee @ 2016-12-31 13:18 UTC (permalink / raw)
  To: J. Bruce Fields, linux-nfs; +Cc: Christoph Hellwig, Steve Dickson, kinglongmee

Commit fae5096ad217
"nfsd: assume writeable exportabled filesystems have f_sync"
have remove the checking of f_sync.

Christoph Hellwig suggests,
"Warn and refuse the writable export."

I think just covert to a readonly export for !fsync filesystem,
also, for a readonly filesystem is reasonable.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/export.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 43e109c..3ec3b6b 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -358,6 +358,18 @@ static int check_export(struct inode *inode, int *flags, unsigned char *uuid)
 	if (*flags & NFSEXP_V4ROOT)
 		*flags |= NFSEXP_READONLY;
 
+	/*
+	 * Convert to a readonly export for that,
+	 * 1. not supported fsync filesystem,
+	 * 2. readonly filesystem.
+	 */
+	if ((!inode->i_fop->fsync || IS_RDONLY(inode))
+	    && !(*flags & NFSEXP_READONLY)) {
+		dprintk("exp_export: Only support readonly export "
+			"for fsync unsupported or readonly filesystem.\n");
+		*flags |= NFSEXP_READONLY;
+	}
+
 	/* There are two requirements on a filesystem to be exportable.
 	 * 1:  We must be able to identify the filesystem from a number.
 	 *       either a device number (so FS_REQUIRES_DEV needed)
-- 
2.9.3


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

end of thread, other threads:[~2017-01-12 21:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-31 13:18 [PATCH] NFSD: only support readonly export for !fsync and readonly filesystem Kinglong Mee
2017-01-04 17:29 ` J. Bruce Fields
2017-01-05 14:20   ` Kinglong Mee
2017-01-05 14:46 ` [PATCH v2] NFSD: Only " Kinglong Mee
2017-01-08 10:07 ` [PATCH] NFSD: only " Christoph Hellwig
2017-01-08 12:43   ` Kinglong Mee
2017-01-12 21:18   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).