Commit e32c0212 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] superblock fixes

From: <fabian.frederick@gmx.fr>

- Avoid sync_fs with clean fs & wait mode = 0

- mark_files_ro overrides pending deletes (doc)

- some trivial doc fixes
parent 91556682
......@@ -329,7 +329,7 @@ void sync_supers(void)
* flags again, which will cause process A to resync everything. Fix that with
* a local mutex.
*
* FIXME: If wait==0, we only really need to call ->sync_fs if s_dirt is true.
* (Fabian) Avoid sync_fs with clean fs & wait mode 0
*/
void sync_filesystems(int wait)
{
......@@ -360,7 +360,7 @@ void sync_filesystems(int wait)
sb->s_count++;
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
if (sb->s_root)
if (sb->s_root && (wait || sb->s_dirt))
sb->s_op->sync_fs(sb, wait);
drop_super(sb);
goto restart;
......@@ -450,6 +450,14 @@ asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf)
return err;
}
/**
* mark_files_ro
* @sb: superblock in question
*
* All files are marked read/only. We don't care about pending
* delete files so this should be used in 'force' mode only
*/
static void mark_files_ro(struct super_block *sb)
{
struct file *f;
......@@ -482,7 +490,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
shrink_dcache_sb(sb);
fsync_super(sb);
/* If we are remounting RDONLY, make sure there are no rw files open */
/* If we are remounting RDONLY and current sb is read/write,
make sure there are no rw files opened */
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
if (force)
mark_files_ro(sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment