linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exports: add allow_umount option for user un-mounting cached exports
@ 2015-05-24 15:16 Kinglong Mee
  2015-06-02  1:43 ` Kinglong Mee
  0 siblings, 1 reply; 2+ messages in thread
From: Kinglong Mee @ 2015-05-24 15:16 UTC (permalink / raw)
  To: Steve Dickson, linux-nfs@vger.kernel.org
  Cc: J. Bruce Fields, NeilBrown, kinglongmee

After nfsd get exports cache, user cannot umounts the filesystem
which base on for a reference of the vfsmnt.

This patch introduces a new option "allow_umount" for nfsd pining to
the vfsmnt, not get a refernce. At all, user can umount now.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 support/include/nfs/export.h | 3 ++-
 support/nfs/exports.c        | 6 ++++++
 utils/exportfs/exports.man   | 8 ++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/support/include/nfs/export.h b/support/include/nfs/export.h
index 1194255..ca4e0c1 100644
--- a/support/include/nfs/export.h
+++ b/support/include/nfs/export.h
@@ -26,7 +26,8 @@
 #define	NFSEXP_CROSSMOUNT	0x4000
 #define NFSEXP_NOACL		0x8000 /* reserved for possible ACL related use */
 #define NFSEXP_V4ROOT		0x10000
-#define NFSEXP_PNFS            0x20000
+#define NFSEXP_PNFS		0x20000
+#define NFSEXP_ALLOW_UMOUNT	0x40000
 /*
  * All flags supported by the kernel before addition of the
  * export_features interface:
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index 0aea6f1..ed5b984 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -276,6 +276,8 @@ putexportent(struct exportent *ep)
 	if (ep->e_flags & NFSEXP_NOREADDIRPLUS)
 		fprintf(fp, "nordirplus,");
 	fprintf(fp, "%spnfs,", (ep->e_flags & NFSEXP_PNFS)? "" : "no_");
+	if (ep->e_flags & NFSEXP_ALLOW_UMOUNT)
+		fprintf(fp, "allow_umount,");
 	if (ep->e_flags & NFSEXP_FSID) {
 		fprintf(fp, "fsid=%d,", ep->e_fsid);
 	}
@@ -586,6 +588,10 @@ parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
 			setflags(NFSEXP_PNFS, active, ep);
 		else if (!strcmp(opt, "no_pnfs"))
 			clearflags(NFSEXP_PNFS, active, ep);
+		else if (!strcmp(opt, "allow_umount"))
+			setflags(NFSEXP_ALLOW_UMOUNT, active, ep);
+		else if (!strcmp(opt, "no_allow_umount"))
+			clearflags(NFSEXP_ALLOW_UMOUNT, active, ep);
 		else if (strncmp(opt, "anonuid=", 8) == 0) {
 			char *oe;
 			ep->e_anonuid = strtol(opt+8, &oe, 10);
diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
index 9309246..d3947a4 100644
--- a/utils/exportfs/exports.man
+++ b/utils/exportfs/exports.man
@@ -417,6 +417,14 @@ devices. The default can be explicitly requested with the
 .I no_pnfs
 option.
 
+.TP
+.IR allow_umount
+This option allows user un-mounting the filesystem where cached nfsd exports
+is based on. Otherwise, the kernel may returns -EBUSY and un-mounting fail.
+The default is without the
+.I allow_umount
+option.
+
 .SS User ID Mapping
 .PP
 .B nfsd
-- 
2.4.1


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

* Re: [PATCH] exports: add allow_umount option for user un-mounting cached exports
  2015-05-24 15:16 [PATCH] exports: add allow_umount option for user un-mounting cached exports Kinglong Mee
@ 2015-06-02  1:43 ` Kinglong Mee
  0 siblings, 0 replies; 2+ messages in thread
From: Kinglong Mee @ 2015-06-02  1:43 UTC (permalink / raw)
  To: Steve Dickson, linux-nfs@vger.kernel.org; +Cc: J. Bruce Fields, NeilBrown

Please ignore this patch. Sorry for the noise.

thanks,
Kinglong Mee

On 5/24/2015 11:16 PM, Kinglong Mee wrote:
> After nfsd get exports cache, user cannot umounts the filesystem
> which base on for a reference of the vfsmnt.
> 
> This patch introduces a new option "allow_umount" for nfsd pining to
> the vfsmnt, not get a refernce. At all, user can umount now.
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  support/include/nfs/export.h | 3 ++-
>  support/nfs/exports.c        | 6 ++++++
>  utils/exportfs/exports.man   | 8 ++++++++
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/support/include/nfs/export.h b/support/include/nfs/export.h
> index 1194255..ca4e0c1 100644
> --- a/support/include/nfs/export.h
> +++ b/support/include/nfs/export.h
> @@ -26,7 +26,8 @@
>  #define	NFSEXP_CROSSMOUNT	0x4000
>  #define NFSEXP_NOACL		0x8000 /* reserved for possible ACL related use */
>  #define NFSEXP_V4ROOT		0x10000
> -#define NFSEXP_PNFS            0x20000
> +#define NFSEXP_PNFS		0x20000
> +#define NFSEXP_ALLOW_UMOUNT	0x40000
>  /*
>   * All flags supported by the kernel before addition of the
>   * export_features interface:
> diff --git a/support/nfs/exports.c b/support/nfs/exports.c
> index 0aea6f1..ed5b984 100644
> --- a/support/nfs/exports.c
> +++ b/support/nfs/exports.c
> @@ -276,6 +276,8 @@ putexportent(struct exportent *ep)
>  	if (ep->e_flags & NFSEXP_NOREADDIRPLUS)
>  		fprintf(fp, "nordirplus,");
>  	fprintf(fp, "%spnfs,", (ep->e_flags & NFSEXP_PNFS)? "" : "no_");
> +	if (ep->e_flags & NFSEXP_ALLOW_UMOUNT)
> +		fprintf(fp, "allow_umount,");
>  	if (ep->e_flags & NFSEXP_FSID) {
>  		fprintf(fp, "fsid=%d,", ep->e_fsid);
>  	}
> @@ -586,6 +588,10 @@ parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
>  			setflags(NFSEXP_PNFS, active, ep);
>  		else if (!strcmp(opt, "no_pnfs"))
>  			clearflags(NFSEXP_PNFS, active, ep);
> +		else if (!strcmp(opt, "allow_umount"))
> +			setflags(NFSEXP_ALLOW_UMOUNT, active, ep);
> +		else if (!strcmp(opt, "no_allow_umount"))
> +			clearflags(NFSEXP_ALLOW_UMOUNT, active, ep);
>  		else if (strncmp(opt, "anonuid=", 8) == 0) {
>  			char *oe;
>  			ep->e_anonuid = strtol(opt+8, &oe, 10);
> diff --git a/utils/exportfs/exports.man b/utils/exportfs/exports.man
> index 9309246..d3947a4 100644
> --- a/utils/exportfs/exports.man
> +++ b/utils/exportfs/exports.man
> @@ -417,6 +417,14 @@ devices. The default can be explicitly requested with the
>  .I no_pnfs
>  option.
>  
> +.TP
> +.IR allow_umount
> +This option allows user un-mounting the filesystem where cached nfsd exports
> +is based on. Otherwise, the kernel may returns -EBUSY and un-mounting fail.
> +The default is without the
> +.I allow_umount
> +option.
> +
>  .SS User ID Mapping
>  .PP
>  .B nfsd
> 

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

end of thread, other threads:[~2015-06-02  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-24 15:16 [PATCH] exports: add allow_umount option for user un-mounting cached exports Kinglong Mee
2015-06-02  1:43 ` Kinglong Mee

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).