Skip to content

Commit f952583

Browse files
jankaragregkh
authored andcommitted
udf: Release preallocation on last writeable close
commit b07ef35 upstream. 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. Fixes: 6fb1ca9 Reported-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 75229a2 commit f952583

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/udf/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
224224
static int udf_release_file(struct inode *inode, struct file *filp)
225225
{
226226
if (filp->f_mode & FMODE_WRITE &&
227-
atomic_read(&inode->i_writecount) > 1) {
227+
atomic_read(&inode->i_writecount) == 1) {
228228
/*
229229
* Grab i_mutex to avoid races with writes changing i_size
230230
* while we are running.

0 commit comments

Comments
 (0)