Menu

#36 EBusy when deleting open file

v1.0 (example)
open
nobody
None
5
2017-01-12
2017-01-12
No

Hello,

smnetfs seems to forbid deleting an open file, and raise an EBUSY error.

Is this behaviour POSIX-compliant ? gvfs allows such deletion.

Test case :

 $ smbnetfs -V
 SMBNetFS version 0.6.0
 libsmbclient version 4.4.5-Ubuntu
 FUSE library version: 2.9.7
 fusermount version: 2.9.7
 using FUSE kernel interface version 7.19

 $ smbnetfs ~/.local.smb
 $ cd ~/.local/smb/[your server]/[your dir]
 $ echo something > myfile   # create a file
 $ less myfile
 [hit ctrl-Z, less is suspended in background]
 [1]+  Stopped                 less myfile

 $ lsof myfile  # check myfile is opened in read-mode
 COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
 less    8596 sylvie    4r   REG   0,42       10   12 myfile

 $ rm myfile
 rm: cannot remove 'myfile': Device or resource busy

 $ strace -e file rm myfile
 execve("/bin/rm", ["rm", "myfile"], [/* 60 vars */]) = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
 access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
 newfstatat(AT_FDCWD, "myfile", {st_mode=S_IFREG|0744, st_size=10, ...}, AT_SYMLINK_NOFOLLOW) = 0
 newfstatat(AT_FDCWD, "myfile", {st_mode=S_IFREG|0744, st_size=10, ...},  AT_SYMLINK_NOFOLLOW) = 0
 faccessat(AT_FDCWD, "myfile", W_OK)     = 0
 unlinkat(AT_FDCWD, "myfile", 0)         = -1 EBUSY (Device or resource busy)
 rm: cannot remove 'myfile': Device or resource busy
 +++ exited with 1 +++

Expected behaviour :

the file should be successfully deleted.

Discussion


Log in to post a comment.