Commit 26c3679101dbccc054dcf370143941844ba70531

Authored by Miklos Szeredi
Committed by Miklos Szeredi
1 parent c2b8f00690

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 <mszeredi@suse.cz>
CC: stable@kernel.org

Showing 2 changed files with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -281,7 +281,8 @@
281 281 fc->blocked = 0;
282 282 wake_up_all(&fc->blocked_waitq);
283 283 }
284   - if (fc->num_background == FUSE_CONGESTION_THRESHOLD) {
  284 + if (fc->num_background == FUSE_CONGESTION_THRESHOLD &&
  285 + fc->connected) {
285 286 clear_bdi_congested(&fc->bdi, READ);
286 287 clear_bdi_congested(&fc->bdi, WRITE);
287 288 }
... ... @@ -292,6 +292,7 @@
292 292 list_del(&fc->entry);
293 293 fuse_ctl_remove_conn(fc);
294 294 mutex_unlock(&fuse_mutex);
  295 + bdi_destroy(&fc->bdi);
295 296 fuse_conn_put(fc);
296 297 }
297 298  
... ... @@ -532,7 +533,6 @@
532 533 if (fc->destroy_req)
533 534 fuse_request_free(fc->destroy_req);
534 535 mutex_destroy(&fc->inst_mutex);
535   - bdi_destroy(&fc->bdi);
536 536 fc->release(fc);
537 537 }
538 538 }