mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anand Avati <avati@redhat.com>
To: Maxim Patlasov <MPatlasov@parallels.com>
Cc: miklos@szeredi.hu, fuse-devel@lists.sourceforge.net,
	bfoster@redhat.com, linux-kernel@vger.kernel.org,
	devel@openvz.org
Subject: Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()
Date: Wed, 12 Jun 2013 12:04:25 -0700	[thread overview]
Message-ID: <51B8C639.7060500@redhat.com> (raw)
In-Reply-To: <20130611105714.24455.38409.stgit@maximpc.sw.ru>

On 6/11/13 3:59 AM, Maxim Patlasov wrote:

> -	if (mode & FALLOC_FL_PUNCH_HOLE) {
> +	if (lock_inode)
>   		mutex_lock(&inode->i_mutex);

> +	if (mode & FALLOC_FL_PUNCH_HOLE)
>   		fuse_set_nowrite(inode);
> -	}

Just for clarity, can you make the condition to check 
FALLOC_FL_PUNCH_HOLE and call to fuse_set_nowrite() nested within the 
larger if (lock_inode) { .. } block? fuse_set_nowrite() should not be 
called without i_mutex acquired. The current style of calling 
mutex_lock() and fuse_set_nowrite() in separate conditions can 
potentially cause bugs in the future if they were to get re-ordered due 
to some unrelated patch. Nesting them makes the relation more explicit 
and clear.

Thanks,
Avati


  parent reply	other threads:[~2013-06-12 19:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 10:59 Maxim Patlasov
2013-06-12 11:40 ` Brian Foster
2013-06-12 18:56   ` Anand Avati
2013-06-12 19:04 ` Anand Avati [this message]
2013-06-13  7:15   ` Maxim Patlasov

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=51B8C639.7060500@redhat.com \
    --to=avati@redhat.com \
    --cc=MPatlasov@parallels.com \
    --cc=bfoster@redhat.com \
    --cc=devel@openvz.org \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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

Powered by JetHome