Commit 8c85e125124a473d6f3e9bb187b0b84207f81d91

Authored by Christoph Hellwig
Committed by Al Viro
1 parent 517bfae283

remove ->write_super call in generic_shutdown_super

We just did a full fs writeout using sync_filesystem before, and if
that's not enough for the filesystem it can perform it's own writeout
in ->put_super, which many filesystems already do.

Move a call to foofs_write_super into every foofs_put_super for now to
guarantee identical behaviour until it's cleaned up by the individual
filesystem maintainers.

Exceptions:

 - affs already has identical copy & pasted code at the beginning of
   affs_put_super so no need to do it twice.
 - xfs does the right thing without it and I have changes pending for
   the xfs tree touching this are so I don't really need conflicts
   here..

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 13 changed files with 36 additions and 2 deletions Side-by-side Diff

... ... @@ -30,6 +30,7 @@
30 30 #define dprintf(x...)
31 31 #endif
32 32  
  33 +static void bfs_write_super(struct super_block *s);
33 34 void dump_imap(const char *prefix, struct super_block *s);
34 35  
35 36 struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
... ... @@ -215,6 +216,9 @@
215 216  
216 217 if (!info)
217 218 return;
  219 +
  220 + if (s->s_dirt)
  221 + bfs_write_super(s);
218 222  
219 223 brelse(info->si_sbh);
220 224 mutex_destroy(&info->bfs_lock);
... ... @@ -258,6 +258,9 @@
258 258 int num_pend;
259 259 struct exofs_sb_info *sbi = sb->s_fs_info;
260 260  
  261 + if (sb->s_dirt)
  262 + exofs_write_super(sb);
  263 +
261 264 /* make sure there are no pending commands */
262 265 for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0;
263 266 num_pend = atomic_read(&sbi->s_curr_pending)) {
... ... @@ -114,6 +114,9 @@
114 114 int i;
115 115 struct ext2_sb_info *sbi = EXT2_SB(sb);
116 116  
  117 + if (sb->s_dirt)
  118 + ext2_write_super(sb);
  119 +
117 120 ext2_xattr_put_super(sb);
118 121 if (!(sb->s_flags & MS_RDONLY)) {
119 122 struct ext2_super_block *es = sbi->s_es;
... ... @@ -576,6 +576,9 @@
576 576 struct ext4_super_block *es = sbi->s_es;
577 577 int i, err;
578 578  
  579 + if (sb->s_dirt)
  580 + ext4_write_super(sb);
  581 +
579 582 ext4_release_system_zone(sb);
580 583 ext4_mb_release(sb);
581 584 ext4_ext_release(sb);
... ... @@ -451,6 +451,9 @@
451 451 {
452 452 struct msdos_sb_info *sbi = MSDOS_SB(sb);
453 453  
  454 + if (sb->s_dirt)
  455 + fat_write_super(sb);
  456 +
454 457 if (sbi->nls_disk) {
455 458 unload_nls(sbi->nls_disk);
456 459 sbi->nls_disk = NULL;
... ... @@ -65,6 +65,8 @@
65 65 */
66 66 static void hfs_put_super(struct super_block *sb)
67 67 {
  68 + if (sb->s_dirt)
  69 + hfs_write_super(sb);
68 70 hfs_mdb_close(sb);
69 71 /* release the MDB's resources */
70 72 hfs_mdb_put(sb);
... ... @@ -199,6 +199,8 @@
199 199 dprint(DBG_SUPER, "hfsplus_put_super\n");
200 200 if (!sb->s_fs_info)
201 201 return;
  202 + if (sb->s_dirt)
  203 + hfsplus_write_super(sb);
202 204 if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) {
203 205 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
204 206  
... ... @@ -174,6 +174,9 @@
174 174  
175 175 D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n"));
176 176  
  177 + if (sb->s_dirt)
  178 + jffs2_write_super(sb);
  179 +
177 180 mutex_lock(&c->alloc_sem);
178 181 jffs2_flush_wbuf_pad(c);
179 182 mutex_unlock(&c->alloc_sem);
... ... @@ -65,6 +65,7 @@
65 65 "(NILFS)");
66 66 MODULE_LICENSE("GPL");
67 67  
  68 +static void nilfs_write_super(struct super_block *sb);
68 69 static int nilfs_remount(struct super_block *sb, int *flags, char *data);
69 70 static int test_exclusive_mount(struct file_system_type *fs_type,
70 71 struct block_device *bdev, int flags);
... ... @@ -314,6 +315,9 @@
314 315 {
315 316 struct nilfs_sb_info *sbi = NILFS_SB(sb);
316 317 struct the_nilfs *nilfs = sbi->s_nilfs;
  318 +
  319 + if (sb->s_dirt)
  320 + nilfs_write_super(sb);
317 321  
318 322 nilfs_detach_segment_constructor(sbi);
319 323  
... ... @@ -468,6 +468,9 @@
468 468 struct reiserfs_transaction_handle th;
469 469 th.t_trans_id = 0;
470 470  
  471 + if (s->s_dirt)
  472 + reiserfs_write_super(s);
  473 +
471 474 /* change file system state to current state if it was mounted with read-write permissions */
472 475 if (!(s->s_flags & MS_RDONLY)) {
473 476 if (!journal_begin(&th, s, 10)) {
... ... @@ -311,8 +311,6 @@
311 311 invalidate_inodes(sb);
312 312 lock_kernel();
313 313  
314   - if (sop->write_super && sb->s_dirt)
315   - sop->write_super(sb);
316 314 if (sop->put_super)
317 315 sop->put_super(sb);
318 316  
... ... @@ -72,6 +72,9 @@
72 72 {
73 73 struct sysv_sb_info *sbi = SYSV_SB(sb);
74 74  
  75 + if (sb->s_dirt)
  76 + sysv_write_super(sb);
  77 +
75 78 if (!(sb->s_flags & MS_RDONLY)) {
76 79 /* XXX ext2 also updates the state here */
77 80 mark_buffer_dirty(sbi->s_bh1);
... ... @@ -1152,6 +1152,9 @@
1152 1152  
1153 1153 UFSD("ENTER\n");
1154 1154  
  1155 + if (sb->s_dirt)
  1156 + ufs_write_super(sb);
  1157 +
1155 1158 if (!(sb->s_flags & MS_RDONLY))
1156 1159 ufs_put_super_internal(sb);
1157 1160