* [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount
@ 2012-03-22 3:13 Miao Xie
2012-03-22 3:41 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2012-03-22 3:13 UTC (permalink / raw)
To: viro, Chris Mason; +Cc: Linux Fsdevel, Linux Btrfs
Some file systems can do some works in the background by kthreads, we'd
better stop those works before we umount the file system, or it is easy to
introduce some problems. So we add an interface that is used to do some
preparation for umount.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/namespace.c | 2 ++
include/linux/fs.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index e608199..f5c1cce 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1173,6 +1173,8 @@ static int do_umount(struct mount *mnt, int flags)
}
br_write_unlock(vfsmount_lock);
up_write(&namespace_sem);
+ if (!retval && sb->s_op->umount_prepare)
+ sb->s_op->umount_prepare(sb);
release_mounts(&umount_list);
return retval;
}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 69cd5bb..6b9657c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1686,6 +1686,7 @@ struct super_operations {
int (*statfs) (struct dentry *, struct kstatfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*umount_begin) (struct super_block *);
+ void (*umount_prepare) (struct super_block *);
int (*show_options)(struct seq_file *, struct dentry *);
int (*show_devname)(struct seq_file *, struct dentry *);
--
1.7.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount
2012-03-22 3:13 [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount Miao Xie
@ 2012-03-22 3:41 ` Al Viro
2012-03-22 5:07 ` Miao Xie
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2012-03-22 3:41 UTC (permalink / raw)
To: Miao Xie; +Cc: Chris Mason, Linux Fsdevel, Linux Btrfs
On Thu, Mar 22, 2012 at 11:13:15AM +0800, Miao Xie wrote:
> Some file systems can do some works in the background by kthreads, we'd
> better stop those works before we umount the file system, or it is easy to
> introduce some problems. So we add an interface that is used to do some
> preparation for umount.
NAK. First of all, fs might be in active use _after_ umount. man 8 umount,
see umount -l there. Moreover, the same superblock may very well be mounted
more than once, so umount of an individual mountpoint would better not do
anything nasty to users of other ones.
IOW, this is completely misguided - you are dealing with whatever problem it
is at least two layers above the right one.
1) vfsmount may be detached from mount trees but remain in active use.
2) there may be many vfsmounts over given struct super_block.
Doing things earlier than the final mntput() runs afoul of (1); doing
them before the final deactivate_locked_super() runs afoul of (2).
What the hell is that thread doing that needs ->s_umount for serialization
and why is it doing that?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount
2012-03-22 3:41 ` Al Viro
@ 2012-03-22 5:07 ` Miao Xie
0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2012-03-22 5:07 UTC (permalink / raw)
To: Al Viro; +Cc: Chris Mason, Linux Fsdevel, Linux Btrfs
On Thu, 22 Mar 2012 03:41:09 +0000, Al Viro wrote:
> On Thu, Mar 22, 2012 at 11:13:15AM +0800, Miao Xie wrote:
>> Some file systems can do some works in the background by kthreads, we'd
>> better stop those works before we umount the file system, or it is easy to
>> introduce some problems. So we add an interface that is used to do some
>> preparation for umount.
>
> NAK. First of all, fs might be in active use _after_ umount. man 8 umount,
> see umount -l there. Moreover, the same superblock may very well be mounted
> more than once, so umount of an individual mountpoint would better not do
> anything nasty to users of other ones.
>
> IOW, this is completely misguided - you are dealing with whatever problem it
> is at least two layers above the right one.
>
> 1) vfsmount may be detached from mount trees but remain in active use.
> 2) there may be many vfsmounts over given struct super_block.
>
> Doing things earlier than the final mntput() runs afoul of (1); doing
> them before the final deactivate_locked_super() runs afoul of (2).
>
> What the hell is that thread doing that needs ->s_umount for serialization
> and why is it doing that?
AFAIK, acquiring ->s_umount is to avoid the filesystem going from r/w to r/o.
This is patch is slapdash, I will find another way to deal with the bug we found.
Thanks for your review.
Miao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-22 5:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 3:13 [RFC PATCH 1/2] vfs: add an interface to do some preparation for umount Miao Xie
2012-03-22 3:41 ` Al Viro
2012-03-22 5:07 ` Miao Xie
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).