[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51B8C639.7060500@redhat.com>
Date: Wed, 12 Jun 2013 12:04:25 -0700
From: Anand Avati <avati@...hat.com>
To: Maxim Patlasov <MPatlasov@...allels.com>
CC: miklos@...redi.hu, fuse-devel@...ts.sourceforge.net,
bfoster@...hat.com, linux-kernel@...r.kernel.org, devel@...nvz.org
Subject: Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists