The optimisation for synchronous mounts was only correct for S_ISREG
files. Directories do not pass through generic_osync_inode() and we
still need to synchronously write out their indirect blocks.
mark_buffer_dirty_inode(bh, inode);
/* We used to sync bh here if IS_SYNC(inode).
* But we now rely upon generic_osync_inode()
- * and b_inode_buffers
+ * and b_inode_buffers. But not for directories.
*/
+ if (S_ISDIR(inode->i_mode) && IS_DIRSYNC(inode)) {
+ ll_rw_block(WRITE, 1, &bh);
+ wait_on_buffer(bh);
+ }
parent = nr;
}
if (n == num)