Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280302
b: refs/heads/master
c: 8e8b879
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Jan 7, 2012
1 parent b2af317 commit b2e87c2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ada4db88634429f4da690ad1c4eb73c93085f0c
refs/heads/master: 8e8b87964bc8dc5c14b6543fc933b7725f07d3ac
23 changes: 0 additions & 23 deletions trunk/fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,29 +474,6 @@ void file_sb_list_del(struct file *file)

#endif

int fs_may_remount_ro(struct super_block *sb)
{
struct file *file;
/* Check that no files are currently opened for writing. */
lg_global_lock(files_lglock);
do_file_list_for_each_entry(sb, file) {
struct inode *inode = file->f_path.dentry->d_inode;

/* File with pending delete? */
if (inode->i_nlink == 0)
goto too_bad;

/* Writeable file? */
if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE))
goto too_bad;
} while_file_list_for_each_entry;
lg_global_unlock(files_lglock);
return 1; /* Tis' cool bro. */
too_bad:
lg_global_unlock(files_lglock);
return 0;
}

/**
* mark_files_ro - mark all files read-only
* @sb: superblock in question
Expand Down
7 changes: 7 additions & 0 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ int sb_prepare_remount_readonly(struct super_block *sb)
struct mount *mnt;
int err = 0;

/* Racy optimization. Recheck the counter under MNT_WRITE_HOLD */
if (atomic_long_read(&sb->s_remove_count))
return -EBUSY;

br_write_lock(vfsmount_lock);
list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
Expand All @@ -460,6 +464,9 @@ int sb_prepare_remount_readonly(struct super_block *sb)
}
}
}
if (!err && atomic_long_read(&sb->s_remove_count))
err = -EBUSY;

if (!err) {
sb->s_readonly_remount = 1;
smp_wmb();
Expand Down
4 changes: 0 additions & 4 deletions trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
retval = sb_prepare_remount_readonly(sb);
if (retval)
return retval;

retval = -EBUSY;
if (!fs_may_remount_ro(sb))
goto cancel_readonly;
}
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2150,8 +2150,6 @@ extern const struct file_operations read_pipefifo_fops;
extern const struct file_operations write_pipefifo_fops;
extern const struct file_operations rdwr_pipefifo_fops;

extern int fs_may_remount_ro(struct super_block *);

#ifdef CONFIG_BLOCK
/*
* return READ, READA, or WRITE
Expand Down

0 comments on commit b2e87c2

Please sign in to comment.