Skip to content

Commit

Permalink
udf: Release preallocation on last writeable close
Browse files Browse the repository at this point in the history
Commit 6fb1ca9 "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: [email protected]
Fixes: 6fb1ca9
Reported-by: Fabian Frederick <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Jan 28, 2015
1 parent 188c901 commit b07ef35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/udf/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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
* while we are running.
Expand Down

0 comments on commit b07ef35

Please sign in to comment.