Commit b07ef352 authored by Jan Kara's avatar Jan Kara

udf: Release preallocation on last writeable close

Commit 6fb1ca92 "udf: Fix race between write(2) and close(2)"
changed the condition when preallocation is released. The idea was that
we don't want to release the preallocation for an inode on close when
there are other writeable file descriptors for the inode. However the
condition was written in the opposite way so we released preallocation
only if there were other writeable file descriptors. Fix the problem by
changing the condition properly.

CC: stable@vger.kernel.org
Fixes: 6fb1ca92Reported-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 188c9019
...@@ -224,7 +224,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -224,7 +224,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
static int udf_release_file(struct inode *inode, struct file *filp) static int udf_release_file(struct inode *inode, struct file *filp)
{ {
if (filp->f_mode & FMODE_WRITE && if (filp->f_mode & FMODE_WRITE &&
atomic_read(&inode->i_writecount) > 1) { atomic_read(&inode->i_writecount) == 1) {
/* /*
* Grab i_mutex to avoid races with writes changing i_size * Grab i_mutex to avoid races with writes changing i_size
* while we are running. * while we are running.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment