Skip to content

Commit 02b9984

Browse files
committed
fs: push sync_filesystem() down to the file system's remount_fs()
Previously, the no-op "mount -o mount /dev/xxx" operation when the file system is already mounted read-write causes an implied, unconditional syncfs(). This seems pretty stupid, and it's certainly documented or guaraunteed to do this, nor is it particularly useful, except in the case where the file system was mounted rw and is getting remounted read-only. However, it's possible that there might be some file systems that are actually depending on this behavior. In most file systems, it's probably fine to only call sync_filesystem() when transitioning from read-write to read-only, and there are some file systems where this is not needed at all (for example, for a pseudo-filesystem or something like romfs). Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected] Cc: Christoph Hellwig <[email protected]> Cc: Artem Bityutskiy <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Evgeniy Dushistov <[email protected]> Cc: Jan Kara <[email protected]> Cc: OGAWA Hirofumi <[email protected]> Cc: Anders Larsen <[email protected]> Cc: Phillip Lougher <[email protected]> Cc: Kees Cook <[email protected]> Cc: Mikulas Patocka <[email protected]> Cc: Petr Vandrovec <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
1 parent 66a4cb1 commit 02b9984

File tree

44 files changed

+53
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+53
-2
lines changed

fs/adfs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ static int parse_options(struct super_block *sb, char *options)
212212

213213
static int adfs_remount(struct super_block *sb, int *flags, char *data)
214214
{
215+
sync_filesystem(sb);
215216
*flags |= MS_NODIRATIME;
216217
return parse_options(sb, data);
217218
}

fs/affs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ affs_remount(struct super_block *sb, int *flags, char *data)
530530

531531
pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
532532

533+
sync_filesystem(sb);
533534
*flags |= MS_NODIRATIME;
534535

535536
memcpy(volume, sbi->s_volume, 32);

fs/befs/linuxvfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
913913
static int
914914
befs_remount(struct super_block *sb, int *flags, char *data)
915915
{
916+
sync_filesystem(sb);
916917
if (!(*flags & MS_RDONLY))
917918
return -EINVAL;
918919
return 0;

fs/btrfs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
13811381
unsigned int old_metadata_ratio = fs_info->metadata_ratio;
13821382
int ret;
13831383

1384+
sync_filesystem(sb);
13841385
btrfs_remount_prepare(fs_info);
13851386

13861387
ret = btrfs_parse_options(root, data);

fs/cifs/cifsfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ static int cifs_show_stats(struct seq_file *s, struct dentry *root)
541541

542542
static int cifs_remount(struct super_block *sb, int *flags, char *data)
543543
{
544+
sync_filesystem(sb);
544545
*flags |= MS_NODIRATIME;
545546
return 0;
546547
}

fs/coda/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void coda_destroy_inodecache(void)
9696

9797
static int coda_remount(struct super_block *sb, int *flags, char *data)
9898
{
99+
sync_filesystem(sb);
99100
*flags |= MS_NOATIME;
100101
return 0;
101102
}

fs/cramfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static void cramfs_kill_sb(struct super_block *sb)
244244

245245
static int cramfs_remount(struct super_block *sb, int *flags, char *data)
246246
{
247+
sync_filesystem(sb);
247248
*flags |= MS_RDONLY;
248249
return 0;
249250
}

fs/debugfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ static int debugfs_remount(struct super_block *sb, int *flags, char *data)
218218
int err;
219219
struct debugfs_fs_info *fsi = sb->s_fs_info;
220220

221+
sync_filesystem(sb);
221222
err = debugfs_parse_options(data, &fsi->mount_opts);
222223
if (err)
223224
goto fail;

fs/devpts/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ static int devpts_remount(struct super_block *sb, int *flags, char *data)
313313
struct pts_fs_info *fsi = DEVPTS_SB(sb);
314314
struct pts_mount_opts *opts = &fsi->mount_opts;
315315

316+
sync_filesystem(sb);
316317
err = parse_mount_options(data, PARSE_REMOUNT, opts);
317318

318319
/*

fs/efs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static void destroy_inodecache(void)
114114

115115
static int efs_remount(struct super_block *sb, int *flags, char *data)
116116
{
117+
sync_filesystem(sb);
117118
*flags |= MS_RDONLY;
118119
return 0;
119120
}

0 commit comments

Comments
 (0)