public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jeremy Allison <jra@samba.org>
To: cygwin@cygwin.com, Jeremy Allison <jra@samba.org>,
	starlight.2012q2@binnacle.cx
Subject: Re: CYGWIN inode over Samba share not constructed from   IndexNumber
Date: Mon, 14 May 2012 17:33:00 -0000	[thread overview]
Message-ID: <20120514173328.GG2607@samba2> (raw)
In-Reply-To: <20120512105349.GM13090@calimero.vinschen.de>

On Sat, May 12, 2012 at 12:53:49PM +0200, Corinna Vinschen wrote:
> Hi Jeremy,
> 
> On May 11 14:15, Jeremy Allison wrote:
> > On Fri, May 11, 2012 at 07:58:43PM +0200, Corinna Vinschen wrote:
> > > On May 11 12:56, starlight.2012q2@binnacle.cx wrote:
> > > > /********************************************************************
> > > >  Create a 64 bit FileIndex. If the file is on the same device as
> > > >  the root of the share, just return the 64-bit inode. If it isn't,
> > > >  mangle as we used to do.
> > > > ********************************************************************/
> > > > 
> > > > uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf)
> > > > {
> > > >    uint64_t file_index;
> > > >    if (conn->base_share_dev == psbuf->st_ex_dev) {
> > > >       return (uint64_t)psbuf->st_ex_ino;
> > > >    }
> > > >    file_index = ((psbuf->st_ex_ino) & UINT32_MAX); /* FileIndexLow */
> > > >    file_index |= ((uint64_t)((psbuf->st_ex_dev) & UINT32_MAX)) << 32; /* FileIndexHigh */
> > > >    return file_index;
> > > > }
> > > 
> > > Which Samba version introduced this behaviour?  Originally, way back
> > > when Samba 3.0.28 was new, the inode numbers were always mangled to be
> > > 64 bit numbers, AFAIK.  The code in Cygwin which doesn't trust 32 bit
> > > inode numbers on remote drives is there for ages, at least since 2007.
> > > 
> > > Fortunately we have an interface which allows to fetch the Samba version
> > > number from the server since Samba 3.0.28a.  So, if we know which Samba
> > > version started to return the real 32 bit inode number, we can adapt.
> > > [...]
> > > inline bool
> > > path_conv::isgood_inode (__ino64_t ino) const
> > > {
> > >   /* We can't trust remote inode numbers of only 32 bit.  That means,
> > >      remote NT4 NTFS, as well as shares of Samba version < 3.0.
> > >      The known exception are SFU NFS shares, which return the valid 32 bit
> > >      inode number from the remote file system unchanged. */
> > >   return hasgood_inode () && (ino > UINT32_MAX || !isremote () || fs_is_nfs ());
> > > }
> > 
> > The get_FileIndex() code has been there since at least 3.6.x, but
> > I'll try and track down when it was first introduced.
> 
> That would be nice.  For now, assuming the get_FileIndex has been
> introduced with 3.6.0, I'd go with this new implementation, stretched
> out and better comments for readability:

get_FileIndex() is in 3.5.x (current code). It was added in
commit 920ffe49290cacd30d9bc582c1c3fee38308c260, which went
in on Thu May 20 11:36:47 2010, which means it went into
Samba 3.5.4.

Jeremy.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2012-05-14 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 16:58 starlight.2012q2
2012-05-11 17:59 ` Corinna Vinschen
2012-05-11 19:49   ` starlight.2012q2
2012-05-11 21:15   ` Jeremy Allison
2012-05-12 10:54     ` Corinna Vinschen
2012-05-14 17:33       ` Jeremy Allison [this message]
2012-05-21 10:49         ` Corinna Vinschen
  -- strict thread matches above, loose matches on Subject: below --
2012-05-11 15:53 starlight.2012q2
2012-05-11 16:22 ` Corinna Vinschen
2012-05-11 16:24 ` Corinna Vinschen
2012-05-11 16:38   ` starlight.2012q2

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=20120514173328.GG2607@samba2 \
    --to=jra@samba.org \
    --cc=cygwin@cygwin.com \
    --cc=starlight.2012q2@binnacle.cx \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).