Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

GFS2: Set s_mode before parsing mount options

In the generic mount_bdev() function, deactivate_locked_super() is
called after the fill_super() call fails, at which point s_mode has been
set. kill_block_super() expects this and dumps a warning when
FMODE_EXCL is not set in s_mode.

In gfs2_mount() we call deactivate_locked_super() on failure of
gfs2_mount_args(), at which point s_mode has not yet been set. This
causes kill_block_super() to dump a stack trace when gfs2 fails to mount
with invalid options. Set s_mode earlier in gfs2_mount() to avoid that.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>

authored by

Andrew Price and committed by
Bob Peterson
6de20eb0 4b813f09

+3 -1
+3 -1
fs/gfs2/ops_fstype.c
··· 1291 1291 up_write(&s->s_umount); 1292 1292 blkdev_put(bdev, mode); 1293 1293 down_write(&s->s_umount); 1294 + } else { 1295 + /* s_mode must be set before deactivate_locked_super calls */ 1296 + s->s_mode = mode; 1294 1297 } 1295 1298 1296 1299 memset(&args, 0, sizeof(args)); ··· 1317 1314 } else { 1318 1315 char b[BDEVNAME_SIZE]; 1319 1316 1320 - s->s_mode = mode; 1321 1317 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); 1322 1318 sb_set_blocksize(s, block_size(bdev)); 1323 1319 error = fill_super(s, &args, flags & MS_SILENT ? 1 : 0);