Skip to content

Commit 436058a

Browse files
dhowellsdavem330
authored andcommitted
[AFS]: Handle multiple mounts of an AFS superblock correctly.
Handle multiple mounts of an AFS superblock correctly, checking to see whether the superblock is already initialised after calling sget() rather than just unconditionally stamping all over it. Also delete the "silent" parameter to afs_fill_super() as it's not used and can, in any case, be obtained from sb->s_flags. Signed-off-by: David Howells <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 63b6be5 commit 436058a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

fs/afs/super.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int afs_test_super(struct super_block *sb, void *data)
212212
/*
213213
* fill in the superblock
214214
*/
215-
static int afs_fill_super(struct super_block *sb, void *data, int silent)
215+
static int afs_fill_super(struct super_block *sb, void *data)
216216
{
217217
struct afs_mount_params *params = data;
218218
struct afs_super_info *as = NULL;
@@ -319,17 +319,23 @@ static int afs_get_sb(struct file_system_type *fs_type,
319319
goto error;
320320
}
321321

322-
sb->s_flags = flags;
323-
324-
ret = afs_fill_super(sb, &params, flags & MS_SILENT ? 1 : 0);
325-
if (ret < 0) {
326-
up_write(&sb->s_umount);
327-
deactivate_super(sb);
328-
goto error;
322+
if (!sb->s_root) {
323+
/* initial superblock/root creation */
324+
_debug("create");
325+
sb->s_flags = flags;
326+
ret = afs_fill_super(sb, &params);
327+
if (ret < 0) {
328+
up_write(&sb->s_umount);
329+
deactivate_super(sb);
330+
goto error;
331+
}
332+
sb->s_flags |= MS_ACTIVE;
333+
} else {
334+
_debug("reuse");
335+
ASSERTCMP(sb->s_flags, &, MS_ACTIVE);
329336
}
330-
sb->s_flags |= MS_ACTIVE;
331-
simple_set_mnt(mnt, sb);
332337

338+
simple_set_mnt(mnt, sb);
333339
afs_put_volume(params.volume);
334340
afs_put_cell(params.default_cell);
335341
_leave(" = 0 [%p]", sb);

0 commit comments

Comments
 (0)