Skip to content

Commit 26c3679

Browse files
Miklos SzerediMiklos Szeredi
authored andcommitted
fuse: destroy bdi on umount
If a fuse filesystem is unmounted but the device file descriptor remains open and a new mount reuses the old device number, then the mount fails with EEXIST and the following warning is printed in the kernel log: WARNING: at fs/sysfs/dir.c:462 sysfs_add_one+0x35/0x3d() sysfs: duplicate filename '0:15' can not be created The cause is that the bdi belonging to the fuse filesystem was destoryed only after the device file was released. Fix this by calling bdi_destroy() from fuse_put_super() instead. Signed-off-by: Miklos Szeredi <[email protected]> CC: [email protected]
1 parent c2b8f00 commit 26c3679

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fs/fuse/dev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ __releases(&fc->lock)
281281
fc->blocked = 0;
282282
wake_up_all(&fc->blocked_waitq);
283283
}
284-
if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
284+
if (fc->num_background == FUSE_CONGESTION_THRESHOLD &&
285+
fc->connected) {
285286
clear_bdi_congested(&fc->bdi, READ);
286287
clear_bdi_congested(&fc->bdi, WRITE);
287288
}

fs/fuse/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ static void fuse_put_super(struct super_block *sb)
292292
list_del(&fc->entry);
293293
fuse_ctl_remove_conn(fc);
294294
mutex_unlock(&fuse_mutex);
295+
bdi_destroy(&fc->bdi);
295296
fuse_conn_put(fc);
296297
}
297298

@@ -532,7 +533,6 @@ void fuse_conn_put(struct fuse_conn *fc)
532533
if (fc->destroy_req)
533534
fuse_request_free(fc->destroy_req);
534535
mutex_destroy(&fc->inst_mutex);
535-
bdi_destroy(&fc->bdi);
536536
fc->release(fc);
537537
}
538538
}

0 commit comments

Comments
 (0)