linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: move check under lock to avoid race
@ 2015-04-08  4:46 Davide Italiano
  2015-04-08  4:46 ` [PATCH] ext4: Move check under lock scope to close a race Davide Italiano
  0 siblings, 1 reply; 4+ messages in thread
From: Davide Italiano @ 2015-04-08  4:46 UTC (permalink / raw)
  To: linux-ext4; +Cc: Davide Italiano

I originally thought that ext4_zero_range() and ext4_collapse() range
duplicated the check in fallocate(), performing it under the lock.
Dmitry explained to me how I was wrong, because there's nothing to
prevent ioctl() to convert indirect <==> extent, so the check needs to
be done with the inode lock held.
Further inspection showed that ext4_fallocate() doesn't re-check inside
the lock scope so I'm not entirely sure it's safe. 
I propose this patch that moves the check inside the lock scope to
guarantee safeness. My original point remains, i.e. there's no need to
duplicate it, in particular if there's nothing that prevents things to
change.
I hope this (take two) is slightly more correct.

Davide Italiano (1):
  ext4: Move check under lock scope to close a race.

 fs/ext4/extents.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

-- 
2.3.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-03  3:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08  4:46 [PATCH] ext4: move check under lock to avoid race Davide Italiano
2015-04-08  4:46 ` [PATCH] ext4: Move check under lock scope to close a race Davide Italiano
2015-04-20 20:50   ` Davide Italiano
2015-05-03  3:21   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).