Skip to content

Commit 73d080d

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro: "The alloc_super() one is a regression in this merge window, lazytime thing is older..." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: VFS: Handle lazytime in do_mount() alloc_super(): do ->s_umount initialization earlier
2 parents 1c6b942 + d7ee946 commit 73d080d

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

fs/namespace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,6 +2826,7 @@ long do_mount(const char *dev_name, const char __user *dir_name,
28262826
SB_DIRSYNC |
28272827
SB_SILENT |
28282828
SB_POSIXACL |
2829+
SB_LAZYTIME |
28292830
SB_I_VERSION);
28302831

28312832
if (flags & MS_REMOUNT)

fs/super.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,24 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
191191

192192
INIT_LIST_HEAD(&s->s_mounts);
193193
s->s_user_ns = get_user_ns(user_ns);
194+
init_rwsem(&s->s_umount);
195+
lockdep_set_class(&s->s_umount, &type->s_umount_key);
196+
/*
197+
* sget() can have s_umount recursion.
198+
*
199+
* When it cannot find a suitable sb, it allocates a new
200+
* one (this one), and tries again to find a suitable old
201+
* one.
202+
*
203+
* In case that succeeds, it will acquire the s_umount
204+
* lock of the old one. Since these are clearly distrinct
205+
* locks, and this object isn't exposed yet, there's no
206+
* risk of deadlocks.
207+
*
208+
* Annotate this by putting this lock in a different
209+
* subclass.
210+
*/
211+
down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);
194212

195213
if (security_sb_alloc(s))
196214
goto fail;
@@ -218,25 +236,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
218236
goto fail;
219237
if (list_lru_init_memcg(&s->s_inode_lru))
220238
goto fail;
221-
222-
init_rwsem(&s->s_umount);
223-
lockdep_set_class(&s->s_umount, &type->s_umount_key);
224-
/*
225-
* sget() can have s_umount recursion.
226-
*
227-
* When it cannot find a suitable sb, it allocates a new
228-
* one (this one), and tries again to find a suitable old
229-
* one.
230-
*
231-
* In case that succeeds, it will acquire the s_umount
232-
* lock of the old one. Since these are clearly distrinct
233-
* locks, and this object isn't exposed yet, there's no
234-
* risk of deadlocks.
235-
*
236-
* Annotate this by putting this lock in a different
237-
* subclass.
238-
*/
239-
down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);
240239
s->s_count = 1;
241240
atomic_set(&s->s_active, 1);
242241
mutex_init(&s->s_vfs_rename_mutex);

0 commit comments

Comments
 (0)