From 551fbce539844621e3a34b7c5c62ff51ff256278 Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Fri, 15 Feb 2008 14:37:32 -0800 Subject: [PATCH] --- yaml --- r: 90946 b: refs/heads/master c: 49e0d02cf018d4edf24bfc8531a816a26367e4ce h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/super.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 307e9b7554bd..ee2d00a6e550 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: aceaf78da92a53f5e1b105649a1b8c0afdb2135c +refs/heads/master: 49e0d02cf018d4edf24bfc8531a816a26367e4ce diff --git a/trunk/fs/super.c b/trunk/fs/super.c index 09008dbd264e..01d5c40e9119 100644 --- a/trunk/fs/super.c +++ b/trunk/fs/super.c @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -567,10 +568,26 @@ static void mark_files_ro(struct super_block *sb) { struct file *f; +retry: file_list_lock(); list_for_each_entry(f, &sb->s_files, f_u.fu_list) { - if (S_ISREG(f->f_path.dentry->d_inode->i_mode) && file_count(f)) - f->f_mode &= ~FMODE_WRITE; + struct vfsmount *mnt; + if (!S_ISREG(f->f_path.dentry->d_inode->i_mode)) + continue; + if (!file_count(f)) + continue; + if (!(f->f_mode & FMODE_WRITE)) + continue; + f->f_mode &= ~FMODE_WRITE; + mnt = mntget(f->f_path.mnt); + file_list_unlock(); + /* + * This can sleep, so we can't hold + * the file_list_lock() spinlock. + */ + mnt_drop_write(mnt); + mntput(mnt); + goto retry; } file_list_unlock(); }