Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 227373 - link() on nfsv4 sometimes fails to update i_nlink count
Summary: link() on nfsv4 sometimes fails to update i_nlink count
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.4
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Jeff Layton
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2007-02-05 17:42 UTC by Jeff Layton
Modified: 2007-11-17 01:14 UTC (History)
5 users (show)

Fixed In Version: RHBA-2007-0791
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-11-15 16:19:35 UTC
Target Upstream Version:

Attachments (Terms of Use)
patch 1 -- add restorefh xdr calls (deleted)
2007-02-05 17:55 UTC, Jeff Layton
no flags Details | Diff
patch 2 -- optimize nfs4 link calls and add postop attributes (deleted)
2007-02-05 17:57 UTC, Jeff Layton
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0791 normal SHIPPED_LIVE Updated kernel packages available for Red Hat Enterprise Linux 4 Update 6 2007-11-14 18:25:55 UTC

Description Jeff Layton 2007-02-05 17:42:30 UTC
This was noticed at connectathon running cthon04 basic test7 against a Solaris
10 NFS server. This is the rename and link test. Sometimes, after creating a
hardlink, a follow-on stat call would still show that i_nlink hadn't been

The issue seems to be that we're not properly doing a postop attribute update
after the LINK call.

Comment 1 Jeff Layton 2007-02-05 17:55:34 UTC
Created attachment 147380 [details]
patch 1 -- add restorefh xdr calls

Preliminary patch to add the xdr functions for RESTOREFH.

Comment 2 Jeff Layton 2007-02-05 17:57:39 UTC
Created attachment 147381 [details]
patch 2 -- optimize nfs4 link calls and add postop attributes

Backported from:

commit 91ba2eeec5e8e86e054937eb3bf5aec5b22b1830
Author: Trond Myklebust <>
Date:	Thu Oct 27 22:12:42 2005 -0400

    NFSv4: Add post-op attributes to nfs4_proc_link()
     Optimise attribute revalidation when hardlinking. Add post-op attributes
     for the directory and the original inode.
     Signed-off-by: Trond Myklebust <>

Comment 3 Jeff Layton 2007-02-20 16:01:19 UTC
Reproducer here is pretty much identical to the one in 227249:

On an nfs4 mount:

$ mkdir d1 d2
$ touch d1/foo; stat d1/foo; ln d1/foo d2/bar; stat d1/foo

The second stat should show 2 hardlinks, but it usually shows only 1. With a
combination of the two patches in this BZ, the problem goes away.

Comment 5 RHEL Product and Program Management 2007-03-08 15:44:08 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update

Comment 6 RHEL Product and Program Management 2007-04-18 22:31:17 UTC
This request was evaluated by Red Hat Kernel Team for inclusion in a Red
Hat Enterprise Linux maintenance release, and has moved to bugzilla 
status POST.

Comment 7 Peter Staubach 2007-04-26 16:39:34 UTC
*** Bug 237894 has been marked as a duplicate of this bug. ***

Comment 8 Jeff Layton 2007-04-26 18:13:46 UTC
It's not clear to me that this is a regression, though maybe we opened a race
window with a different patch and that makes this occur more often, or we
eliminated a GETATTR somewhere.

It looks like Steve D. made mention of seeing this issue as well, and said that
the patchset for bz155929 seemed to fix it for him. This does not seem to be the
case since we still see the problem even with his patches.

I think this patch is the surest way to fix this since it ensures that the attrs
are updated after the link.

Comment 9 Jason Baron 2007-06-05 15:41:34 UTC
committed in stream U6 build 55.6. A test kernel with this patch is available

Comment 11 Don Domingo 2007-08-23 02:06:14 UTC
added to RHEL4.6 release notes under "Kernel-Related Updates":

fixed an nfsv4 link bug that prevented i_nlink counts from updating properly

please advise if any revisions are necessary. thanks!

Comment 13 errata-xmlrpc 2007-11-15 16:19:35 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

Note You need to log in before you can comment on or make changes to this bug.