Skip to content

Commit 7cc9112

Browse files
amir73ilMiklos Szeredi
authored andcommitted
fuse: fix parallel dio write on file open in passthrough mode
Parallel dio write takes a negative refcount of fi->iocachectr and so does open of file in passthrough mode. The refcount of passthrough mode is associated with attach/detach of a fuse_backing object to fuse inode. For parallel dio write, the backing file is irrelevant, so the call to fuse_inode_uncached_io_start() passes a NULL fuse_backing object. Passing a NULL fuse_backing will result in false -EBUSY error if the file is already open in passthrough mode. Allow taking negative fi->iocachectr refcount with NULL fuse_backing, because it does not conflict with an already attached fuse_backing object. Fixes: 4a90451 ("fuse: implement open in passthrough mode") Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 4864a6d commit 7cc9112

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/fuse/iomode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int fuse_inode_uncached_io_start(struct fuse_inode *fi, struct fuse_backing *fb)
9090
spin_lock(&fi->lock);
9191
/* deny conflicting backing files on same fuse inode */
9292
oldfb = fuse_inode_backing(fi);
93-
if (oldfb && oldfb != fb) {
93+
if (fb && oldfb && oldfb != fb) {
9494
err = -EBUSY;
9595
goto unlock;
9696
}
@@ -101,7 +101,7 @@ int fuse_inode_uncached_io_start(struct fuse_inode *fi, struct fuse_backing *fb)
101101
fi->iocachectr--;
102102

103103
/* fuse inode holds a single refcount of backing file */
104-
if (!oldfb) {
104+
if (fb && !oldfb) {
105105
oldfb = fuse_inode_backing_set(fi, fb);
106106
WARN_ON_ONCE(oldfb != NULL);
107107
} else {

0 commit comments

Comments
 (0)