Re: [PATCH] nilfs: fix unprotected super_block flags modification in nilfs_error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
On Fri, 26 Feb 2010 14:33:32 +0900, Jiro SEKIBA <jir@xxxxxxxxx> wrote:
> Hi,
> 
> This is a trivial patch to protect super_block flags.
> 
> super_block flags must be protected by the proper semaphore
> when modifying it.
> 
> Signed-off-by: Jiro SEKIBA <jir@xxxxxxxxx>
> ---
>  fs/nilfs2/super.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
> index 8173fae..3ee02b8 100644
> --- a/fs/nilfs2/super.c
> +++ b/fs/nilfs2/super.c
> @@ -110,7 +110,9 @@ void nilfs_error(struct super_block *sb, const char *function,
>  
>  		if (nilfs_test_opt(sbi, ERRORS_RO)) {
>  			printk(KERN_CRIT "Remounting filesystem read-only\n");
> +			down_write(&nilfs->ns_super_sem);
>  			sb->s_flags |= MS_RDONLY;
> +			up_write(&nilfs->ns_super_sem);
>  		}
>  	}
>  

This has a potential for recursive locking since nilfs_error() can be
called from within nilfs_remount() that locks ns_super_sem.

It seems unfavorable though the above sb->s_flags operation is not
protected.  I hope we can find a simple and better workaround.

Regards,
Ryusuke Konishi
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux