Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Matt Mackall <mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org>
To: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Strange hardlink behavior with CIFS
Date: Wed, 27 Oct 2010 12:31:26 -0500	[thread overview]
Message-ID: <1288200686.3764.55.camel@calx> (raw)
In-Reply-To: <4CBD6843.3060702-l3A5Bk7waGM@public.gmane.org>

On Tue, 2010-10-19 at 15:13 +0530, Suresh Jayaraman wrote:
> On 10/19/2010 12:34 AM, Matt Mackall wrote:
> > With Linux 2.6.32-35 and either Windows or Samba in nounix mode,
> > hardlink counts can mysteriously disappear:
> > 
> > - create hardlink pair foo,bar
> > - stat foo -> nlink = 2
> > - open foo
> > - stat foo -> nlink = 1
> > - close
> > - wait or sync
> > - ls -l -> nlink = 2
> > 
> > Original report is here:
> > 
> > http://mercurial.selenic.com/bts/issue1866
> > 
> 
> A quick test on 2.6.36-rc4 kernel reveals that the problem is no longer
> reproducible. Could you try a more recent kernel and see whether the
> problem is reproducible?

Test continues to fail with 2.6.36.

# uname -a
Linux calx 2.6.36 #71 SMP Tue Oct 26 02:23:34 CDT 2010 x86_64 GNU/Linux
# mount -o nounix //localhost/stuff cifs
           ^^^^^^
# cd cifs
# touch foo
# ln foo bar
# ./h
file: foo nlinks 2
file: foo nlinks 1
file: foo nlinks 1

# cat h.c
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>

#define FPATH "foo"

int main(void)
{
	int rc, fh;
	struct stat st;

	rc = lstat(FPATH, &st);
	printf("file: %s nlinks %d\n", FPATH, st.st_nlink);

	fh = open(FPATH, 0, O_RDONLY);

	rc = lstat(FPATH, &st);
	printf("file: %s nlinks %d\n", FPATH, st.st_nlink);

	close(fh);

	rc = lstat(FPATH, &st);
	printf("file: %s nlinks %d\n", FPATH, st.st_nlink);

	return 0;
}




-- 
Mathematics is the supreme nostalgia of our time.

  parent reply	other threads:[~2010-10-27 17:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 19:04 Strange hardlink behavior with CIFS Matt Mackall
2010-10-19  9:43 ` Suresh Jayaraman
2010-10-20  9:18   ` bjoern
     [not found]     ` <loom.20101020T111137-239-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2010-10-20 15:01       ` Steve French
     [not found]   ` <4CBD6843.3060702-l3A5Bk7waGM@public.gmane.org>
2010-10-27 17:31     ` Matt Mackall [this message]
2010-10-27 20:32       ` Jeff Layton
     [not found]         ` <20101027163230.28591971-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-10-27 20:49           ` Matt Mackall
2010-10-28 11:08           ` Suresh Jayaraman
     [not found]             ` <4CC959AC.10301-l3A5Bk7waGM@public.gmane.org>
2010-10-28 11:46               ` Jeff Layton
     [not found]                 ` <20101028074650.3e035241-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-10-29 10:51                   ` Suresh Jayaraman
     [not found]                     ` <4CCAA73D.80009-l3A5Bk7waGM@public.gmane.org>
2010-10-29 11:19                       ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288200686.3764.55.camel@calx \
    --to=mpm-vdjraj4gl5zbdgjk7y7tuq@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sjayaraman-l3A5Bk7waGM@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox