public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org,
	Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Subject: Re: [PATCHv5 10/16] exofs: fix race condition in marking SB dirty
Date: Sun, 06 Jun 2010 19:12:41 +0300	[thread overview]
Message-ID: <4C0BC8F9.2050306@panasas.com> (raw)
In-Reply-To: <1275835829-1478-11-git-send-email-dedekind1@gmail.com>

On 06/06/2010 05:50 PM, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> 
> When synchronizing the superblock, exofs first initiates the SB write
> (a) and then marks the superblock as clean (b). However, meanwhile
> (between (a) and (b)) someone else can modify the superblock and
> mark it as dirty. This would be a race condition, and the result
> would be that we'd end up with a modified superblock which would
> nevertheless be marked as clean (because of (b)). This means that
> 'sync_supers()' would never call our '->write_super()', at least
> not until yet another SB change happens.
> 
> This patch fixes this race condition by marking the superblock as
> clean before initiating the write operation.
> 
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Cc: Boaz Harrosh <bharrosh@panasas.com>

Ack-by: Boaz Harrosh <bharrosh@panasas.com>

Grate fix thanks
Boaz

> ---
>  fs/exofs/super.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/exofs/super.c b/fs/exofs/super.c
> index 74ccbdc..0b432b9 100644
> --- a/fs/exofs/super.c
> +++ b/fs/exofs/super.c
> @@ -219,6 +219,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
>  	 *       the fscb->s_dev_table_oid member. There is no read-modify-write
>  	 *       here.
>  	 */
> +	sb_mark_clean(sb);
>  	ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
>  	memset(fscb, 0, ios->length);
>  	fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
> @@ -237,7 +238,6 @@ int exofs_sync_fs(struct super_block *sb, int wait)
>  		EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__);
>  		goto out;
>  	}
> -	sb_mark_clean(sb);
>  
>  out:
>  	EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);


  reply	other threads:[~2010-06-06 16:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 14:50 [PATCHv5 00/16] kill unnecessary SB sync wake-ups + cleanups Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 01/16] VFS: introduce helpers for the s_dirt flag Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 02/16] VFS: rename s_dirt to s_dirty Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 03/16] writeback: lessen sync_supers wakeup count Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 04/16] VFS: add memory barrier to sb_mark_clean and sb_mark_dirty Artem Bityutskiy
2010-06-06 17:16   ` Artem Bityutskiy
2010-06-06 19:22     ` Artem Bityutskiy
2010-06-09 16:36   ` Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 05/16] AFFS: clean up dirty flag usage Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 06/16] AFFS: wait for sb synchronization when needed Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 07/16] AFFS: fix race condition in marking SB dirty Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 08/16] BFS: clean up the superblock usage Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 09/16] btrfs: remove junk sb_mark_dirty call Artem Bityutskiy
2010-06-12  7:36   ` Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 10/16] exofs: fix race condition in marking SB dirty Artem Bityutskiy
2010-06-06 16:12   ` Boaz Harrosh [this message]
2010-06-06 14:50 ` [PATCHv5 11/16] ext2: " Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 12/16] ext4: " Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 13/16] HFS: " Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 14/16] HFS: kill hfs_buffer_sync Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 15/16] HFS: wait for sb synchronization when needed Artem Bityutskiy
2010-06-06 14:50 ` [PATCHv5 16/16] HFSPLUS: wait for synchronization Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C0BC8F9.2050306@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=dedekind1@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox