Project

General

Profile

Bug #13665

rename with non-regular target over NFS generates .nfsXXXX files

Added by Marcel Telka 28 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
nfs - NFS server and client
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When the target for rename over NFS is a non-regular file (e.g. symlink) the rename operation always generates .nfsXXXX file:
root@t2:~# mkdir /net/t1/tmp/test
root@t2:~# touch /net/t1/tmp/test/a
root@t2:~# ln -s c /net/t1/tmp/test/b
root@t2:~# ls -la /net/t1/tmp/test/
total 24
drwxr-xr-x   2 nobody   nobody       233 Mar 23 20:58 .
drwxrwxrwt   3 nobody   nobody       248 Mar 23 20:57 ..
-rw-r--r--   1 nobody   nobody         0 Mar 23 20:58 a
lrwxrwxrwx   1 nobody   nobody         1 Mar 23 20:58 b -> c
root@t2:~# mv /net/t1/tmp/test/a /net/t1/tmp/test/b
root@t2:~# ls -la /net/t1/tmp/test/
total 24
drwxr-xr-x   2 nobody   nobody       240 Mar 23 20:58 .
drwxrwxrwt   3 nobody   nobody       248 Mar 23 20:57 ..
lrwxrwxrwx   1 nobody   nobody         1 Mar 23 20:58 .nfs1784 -> c
-rw-r--r--   1 nobody   nobody         0 Mar 23 20:58 b
root@t2:~#

The reason for that behaviour is this code in nfs4rename():
7801        if (nvp->v_type != VREG) {
7802            /*
7803             * Purge the name cache of all references to this vnode
7804             * so that we can check the reference count to infer
7805             * whether it is active or not.
7806             */
7807            if (nvp->v_count > 1)
7808                dnlc_purge_vp(nvp);
7809
7810            isactive = nvp->v_count > 1;
7811        } else {

The isactive value is set to non-zero there because nvp->v_count is 2. Then later the .nfsXXXX is created because of this. The nvp->v_count is 2 because:
  • nfs4rename() holds the file via the nfs4lookup() call at line 7776, and
  • vn_renameat() holds the file as targvp at line 1700 in vnode.c.

The possible solution one might think about could be just changing line 7810 to this:

7810            isactive = nvp->v_count > 2;

But, unfortunately, that won't work, because it is not guaranteed that the second hold comes from vn_renameat() because nbl_conflict() calls in vnode.c are racy (see #13664).


Related issues

Related to illumos gate - Bug #13664: nbl_conflict() calls in vnode.c are racyNew

Actions
Related to illumos gate - Bug #4271: NFSv4 server: delegations should be recalled before the nbl_conflict() callNew2013-10-24

Actions
#1

Updated by Marcel Telka 28 days ago

  • Related to Bug #13664: nbl_conflict() calls in vnode.c are racy added
#2

Updated by Marcel Telka 28 days ago

  • Related to Bug #4271: NFSv4 server: delegations should be recalled before the nbl_conflict() call added

Also available in: Atom PDF