All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
@ 2012-07-08  3:17 Namjae Jeon
  2012-07-10 14:59 ` J. Bruce Fields
  0 siblings, 1 reply; 8+ messages in thread
From: Namjae Jeon @ 2012-07-08  3:17 UTC (permalink / raw)
  To: SteveD, bfields, Trond.Myklebust
  Cc: linux-nfs, linux-kernel, Namjae Jeon, Vivek Trivedi

For removing storage device - user needs to safely un-mount the device
and then eject. But if 'EBUSY' occurs in umount then it will create
confusion for the user as it will mean some I/O is in progress - and
won't allow user to safely ejecting device.

1. Without this patch:

On NFS Client:
$ mount.nfs <NFS_SERVER>:/mnt /mnt
$ umount.nfs /mnt

On NFS Server:
$ umount /mnt
umount: can't umount /mnt: Device or resource busy

2. With this patch:

On NFS Client:
$ mount.nfs <NFS_SERVER>:/mnt /mnt
$ umount.nfs /mnt

On NFS Server:
$ umount.nfs /mnt --> umount successful

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Vivek Trivedi <vtrivedi018@gmail.com>
---
 utils/mountd/mountd.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index bcf5080..2b190fb 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -275,6 +275,7 @@ mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *UNUSED(resp))
 		return 1;
 
 	mountlist_del(host_ntop(sap, buf, sizeof(buf)), p);
+	cache_flush(1);
 	return 1;
 }
 
@@ -292,6 +293,7 @@ mount_umntall_1_svc(struct svc_req *rqstp, void *UNUSED(argp),
 	auth_reload();
 
 	mountlist_del_all(nfs_getrpccaller(rqstp->rq_xprt));
+	cache_flush(1);
 	return 1;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-08  3:17 [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure Namjae Jeon
@ 2012-07-10 14:59 ` J. Bruce Fields
  2012-07-11  4:10   ` Namjae Jeon
  0 siblings, 1 reply; 8+ messages in thread
From: J. Bruce Fields @ 2012-07-10 14:59 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
> For removing storage device - user needs to safely un-mount the device
> and then eject. But if 'EBUSY' occurs in umount then it will create
> confusion for the user as it will mean some I/O is in progress - and
> won't allow user to safely ejecting device.

The one drawback is that recovering from the cache flushes might be a
little expensive if you have a lot of exports in use.

I'm curious, since you said this was for a usb disk: are users expected
to just unplug it (in which case--is it read only?) or do they have some
way of unmounting before they pull the plug?

--b.

> 
> 1. Without this patch:
> 
> On NFS Client:
> $ mount.nfs <NFS_SERVER>:/mnt /mnt
> $ umount.nfs /mnt
> 
> On NFS Server:
> $ umount /mnt
> umount: can't umount /mnt: Device or resource busy
> 
> 2. With this patch:
> 
> On NFS Client:
> $ mount.nfs <NFS_SERVER>:/mnt /mnt
> $ umount.nfs /mnt
> 
> On NFS Server:
> $ umount.nfs /mnt --> umount successful
> 
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
> Signed-off-by: Vivek Trivedi <vtrivedi018@gmail.com>
> ---
>  utils/mountd/mountd.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
> index bcf5080..2b190fb 100644
> --- a/utils/mountd/mountd.c
> +++ b/utils/mountd/mountd.c
> @@ -275,6 +275,7 @@ mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *UNUSED(resp))
>  		return 1;
>  
>  	mountlist_del(host_ntop(sap, buf, sizeof(buf)), p);
> +	cache_flush(1);
>  	return 1;
>  }
>  
> @@ -292,6 +293,7 @@ mount_umntall_1_svc(struct svc_req *rqstp, void *UNUSED(argp),
>  	auth_reload();
>  
>  	mountlist_del_all(nfs_getrpccaller(rqstp->rq_xprt));
> +	cache_flush(1);
>  	return 1;
>  }
>  
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-10 14:59 ` J. Bruce Fields
@ 2012-07-11  4:10   ` Namjae Jeon
  2012-07-11 14:09     ` J. Bruce Fields
  0 siblings, 1 reply; 8+ messages in thread
From: Namjae Jeon @ 2012-07-11  4:10 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

2012/7/10, J. Bruce Fields <bfields@fieldses.org>:
> On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
>> For removing storage device - user needs to safely un-mount the device
>> and then eject. But if 'EBUSY' occurs in umount then it will create
>> confusion for the user as it will mean some I/O is in progress - and
>> won't allow user to safely ejecting device.
>
Hi James.
> The one drawback is that recovering from the cache flushes might be a
> little expensive if you have a lot of exports in use.
Good point. I will look for more there is the method flush only mount entry.
>
> I'm curious, since you said this was for a usb disk: are users expected
> to just unplug it (in which case--is it read only?) or do they have some
> way of unmounting before they pull the plug?
Users expected to unplug it on both read only and read/write.
And there is no way that system be prepared to know about the
intelligence when the user is going to unplug.
if the user really want to detach the device safely. There is an
option like the desktop PC - where, we can say - umount/eject the
device. There is a proper user interface for safe removal.
but they can not unplug safely if usb device is mounted with nfs
because of this issue.
>
> --b.
>

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-11  4:10   ` Namjae Jeon
@ 2012-07-11 14:09     ` J. Bruce Fields
  2012-07-11 22:38       ` Namjae Jeon
  0 siblings, 1 reply; 8+ messages in thread
From: J. Bruce Fields @ 2012-07-11 14:09 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

On Wed, Jul 11, 2012 at 01:10:53PM +0900, Namjae Jeon wrote:
> 2012/7/10, J. Bruce Fields <bfields@fieldses.org>:
> > On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
> >> For removing storage device - user needs to safely un-mount the device
> >> and then eject. But if 'EBUSY' occurs in umount then it will create
> >> confusion for the user as it will mean some I/O is in progress - and
> >> won't allow user to safely ejecting device.
> >
> Hi James.
> > The one drawback is that recovering from the cache flushes might be a
> > little expensive if you have a lot of exports in use.
> Good point. I will look for more there is the method flush only mount entry.

I don't think there's a good way to flush only one entry.

Also, this isn't going to help for NFSv4 since a v4 client won't do an
unmount call.

> > I'm curious, since you said this was for a usb disk: are users expected
> > to just unplug it (in which case--is it read only?) or do they have some
> > way of unmounting before they pull the plug?
> Users expected to unplug it on both read only and read/write.
> And there is no way that system be prepared to know about the
> intelligence when the user is going to unplug.
> if the user really want to detach the device safely. There is an
> option like the desktop PC - where, we can say - umount/eject the
> device. There is a proper user interface for safe removal.
> but they can not unplug safely if usb device is mounted with nfs
> because of this issue.

Ideal might be to get some way to notify nfsd when the device
diseappears or the filesystem wants to unmount.  I don't know how to do
that.

--b.

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-11 14:09     ` J. Bruce Fields
@ 2012-07-11 22:38       ` Namjae Jeon
  2012-07-11 22:43         ` Namjae Jeon
  0 siblings, 1 reply; 8+ messages in thread
From: Namjae Jeon @ 2012-07-11 22:38 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

2012/7/11, J. Bruce Fields <bfields@fieldses.org>:
> On Wed, Jul 11, 2012 at 01:10:53PM +0900, Namjae Jeon wrote:
>> 2012/7/10, J. Bruce Fields <bfields@fieldses.org>:
>> > On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
>> >> For removing storage device - user needs to safely un-mount the device
>> >> and then eject. But if 'EBUSY' occurs in umount then it will create
>> >> confusion for the user as it will mean some I/O is in progress - and
>> >> won't allow user to safely ejecting device.
>> >
>> Hi James.
>> > The one drawback is that recovering from the cache flushes might be a
>> > little expensive if you have a lot of exports in use.
>> Good point. I will look for more there is the method flush only mount
>> entry.
>
> I don't think there's a good way to flush only one entry.
>
> Also, this isn't going to help for NFSv4 since a v4 client won't do an
> unmount call.
Okay.
>
>> > I'm curious, since you said this was for a usb disk: are users expected
>> > to just unplug it (in which case--is it read only?) or do they have
>> > some
>> > way of unmounting before they pull the plug?
>> Users expected to unplug it on both read only and read/write.
>> And there is no way that system be prepared to know about the
>> intelligence when the user is going to unplug.
>> if the user really want to detach the device safely. There is an
>> option like the desktop PC - where, we can say - umount/eject the
>> device. There is a proper user interface for safe removal.
>> but they can not unplug safely if usb device is mounted with nfs
>> because of this issue.
>
> Ideal might be to get some way to notify nfsd when the device
> diseappears or the filesystem wants to unmount.  I don't know how to do
> that.
Okay. I will look for good solution for this issue.
Thanks.
>
> --b.
>

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-11 22:38       ` Namjae Jeon
@ 2012-07-11 22:43         ` Namjae Jeon
  2012-07-24 16:24           ` J. Bruce Fields
  0 siblings, 1 reply; 8+ messages in thread
From: Namjae Jeon @ 2012-07-11 22:43 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

2012/7/12, Namjae Jeon <linkinjeon@gmail.com>:
> 2012/7/11, J. Bruce Fields <bfields@fieldses.org>:
>> On Wed, Jul 11, 2012 at 01:10:53PM +0900, Namjae Jeon wrote:
>>> 2012/7/10, J. Bruce Fields <bfields@fieldses.org>:
>>> > On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
>>> >> For removing storage device - user needs to safely un-mount the
>>> >> device
>>> >> and then eject. But if 'EBUSY' occurs in umount then it will create
>>> >> confusion for the user as it will mean some I/O is in progress - and
>>> >> won't allow user to safely ejecting device.
>>> >
>>> Hi James.
>>> > The one drawback is that recovering from the cache flushes might be a
>>> > little expensive if you have a lot of exports in use.
>>> Good point. I will look for more there is the method flush only mount
>>> entry.
>>
>> I don't think there's a good way to flush only one entry.
>>
>> Also, this isn't going to help for NFSv4 since a v4 client won't do an
>> unmount call.
> Okay.
>>
>>> > I'm curious, since you said this was for a usb disk: are users
>>> > expected
>>> > to just unplug it (in which case--is it read only?) or do they have
>>> > some
>>> > way of unmounting before they pull the plug?
>>> Users expected to unplug it on both read only and read/write.
>>> And there is no way that system be prepared to know about the
>>> intelligence when the user is going to unplug.
>>> if the user really want to detach the device safely. There is an
>>> option like the desktop PC - where, we can say - umount/eject the
>>> device. There is a proper user interface for safe removal.
>>> but they can not unplug safely if usb device is mounted with nfs
>>> because of this issue.
>>
>> Ideal might be to get some way to notify nfsd when the device
>> diseappears or the filesystem wants to unmount.  I don't know how to do
>> that.
> Okay. I will look for good solution for this issue.
> Thanks.
Hi James.
I have a question.
If we found the method to notify nfs when unplugging device, Can nfsd
flush only entry of usb mount ?

Thanks.

>>
>> --b.
>>
>

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-11 22:43         ` Namjae Jeon
@ 2012-07-24 16:24           ` J. Bruce Fields
  2012-07-28  4:52             ` Namjae Jeon
  0 siblings, 1 reply; 8+ messages in thread
From: J. Bruce Fields @ 2012-07-24 16:24 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

On Thu, Jul 12, 2012 at 07:43:49AM +0900, Namjae Jeon wrote:
> 2012/7/12, Namjae Jeon <linkinjeon@gmail.com>:
> > 2012/7/11, J. Bruce Fields <bfields@fieldses.org>:
> >> On Wed, Jul 11, 2012 at 01:10:53PM +0900, Namjae Jeon wrote:
> >>> 2012/7/10, J. Bruce Fields <bfields@fieldses.org>:
> >>> > On Sat, Jul 07, 2012 at 11:17:39PM -0400, Namjae Jeon wrote:
> >>> >> For removing storage device - user needs to safely un-mount the
> >>> >> device
> >>> >> and then eject. But if 'EBUSY' occurs in umount then it will create
> >>> >> confusion for the user as it will mean some I/O is in progress - and
> >>> >> won't allow user to safely ejecting device.
> >>> >
> >>> Hi James.
> >>> > The one drawback is that recovering from the cache flushes might be a
> >>> > little expensive if you have a lot of exports in use.
> >>> Good point. I will look for more there is the method flush only mount
> >>> entry.
> >>
> >> I don't think there's a good way to flush only one entry.
> >>
> >> Also, this isn't going to help for NFSv4 since a v4 client won't do an
> >> unmount call.
> > Okay.
> >>
> >>> > I'm curious, since you said this was for a usb disk: are users
> >>> > expected
> >>> > to just unplug it (in which case--is it read only?) or do they have
> >>> > some
> >>> > way of unmounting before they pull the plug?
> >>> Users expected to unplug it on both read only and read/write.
> >>> And there is no way that system be prepared to know about the
> >>> intelligence when the user is going to unplug.
> >>> if the user really want to detach the device safely. There is an
> >>> option like the desktop PC - where, we can say - umount/eject the
> >>> device. There is a proper user interface for safe removal.
> >>> but they can not unplug safely if usb device is mounted with nfs
> >>> because of this issue.
> >>
> >> Ideal might be to get some way to notify nfsd when the device
> >> diseappears or the filesystem wants to unmount.  I don't know how to do
> >> that.
> > Okay. I will look for good solution for this issue.
> > Thanks.
> Hi James.
> I have a question.
> If we found the method to notify nfs when unplugging device,

What's that?

> Can nfsd
> flush only entry of usb mount ?

Hm, I don't think there's anything that does that now.  But I think if
you look it up and set the cache item's expiry_time to the current unix
time in seconds, that'd be at least a start.

Come to think of it you should actually be able to do that from
userspace if you want: just write a negative cache entry for that
export.

However you do this there may still be some brief delay while some
thread finishes processing an rpc using the entry; I don't know what to
do about that.  It's unlikely in your case (where clients have unmounted
first).

--b.

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

* Re: [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure.
  2012-07-24 16:24           ` J. Bruce Fields
@ 2012-07-28  4:52             ` Namjae Jeon
  0 siblings, 0 replies; 8+ messages in thread
From: Namjae Jeon @ 2012-07-28  4:52 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: SteveD, Trond.Myklebust, linux-nfs, linux-kernel, Vivek Trivedi

>> Hi James.
>> I have a question.
>> If we found the method to notify nfs when unplugging device,
>
Hi James.
> What's that?
I need to check more...

>
>> Can nfsd
>> flush only entry of usb mount ?
>
> Hm, I don't think there's anything that does that now.  But I think if
> you look it up and set the cache item's expiry_time to the current unix
> time in seconds, that'd be at least a start.
>
> Come to think of it you should actually be able to do that from
> userspace if you want: just write a negative cache entry for that
> export.
>
> However you do this there may still be some brief delay while some
> thread finishes processing an rpc using the entry; I don't know what to
> do about that.  It's unlikely in your case (where clients have unmounted
> first).
Okay, I will look for more.
Thanks for your reply.
>
> --b.
>

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

end of thread, other threads:[~2012-07-28  4:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-08  3:17 [PATCH] nfs-util: Add cache_flush in mountd UMNT procedure Namjae Jeon
2012-07-10 14:59 ` J. Bruce Fields
2012-07-11  4:10   ` Namjae Jeon
2012-07-11 14:09     ` J. Bruce Fields
2012-07-11 22:38       ` Namjae Jeon
2012-07-11 22:43         ` Namjae Jeon
2012-07-24 16:24           ` J. Bruce Fields
2012-07-28  4:52             ` Namjae Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.