Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Pavel Shilovsky <piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
Cc: Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH] CIFS: Fix NT_STATUS_ACCESS_DENIED for mounts with prefixpath option
Date: Tue, 4 Oct 2011 07:23:08 -0400	[thread overview]
Message-ID: <20111004072308.6010ecbc@tlielax.poochiereds.net> (raw)
In-Reply-To: <CAKywueQ1shXsy1rSBJx1H7aD80wg-3=GbvKhLXHeH_nJRz3b2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, 4 Oct 2011 13:01:35 +0400
Pavel Shilovsky <piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org> wrote:

> Sorry for the long delay on this.
> 
> 2011/8/31 Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>:
> > If the parent dentry is negative, you mean. Ok, Good point...
> >
> > Ok, so you're proposing to wrap this check in a big mutex to prevent
> > this race when the parent dentry is negative. In the event that it's
> > positive though, you'll need to make sure that you take the parent's
> > i_mutex.
> 
> Yes, that's what I meant.
> 
> >
> > I don't have a great feel for this sort of dcache trickery, but this
> > whole scheme sounds like it's going to break a lot of assumptions about
> > how the dcache works. In particular having negative dentries with
> > children sounds very problematic.
> >
> > Would it be better to simply make the initial dentry in this case be a
> > disconnected or root dentry (see DCACHE_DISCONNECTED), and then later
> > "graft" it into a larger tree if the parent comes to life?
> >
> 
> I am not sure that I understand you right. As I see what you suggest:
> 
> Let's predict we have mounted //server/share/a/ so
> 1. Dummy superblock root is set to //server/share/a/.
> 2. Get an inode and a dentry for //server/share/a/.
> 
> Then, we mount //server/share/, so
> 3. Get an inode and a dentry for //server/share/
> 
> Then, we reach //server/share/a from the second share, so we need to
> find the existing dentry from the first share. We can store all
> dentries that pass through cifs_lookup and cifs_get_root with a full
> path hash and use them in future when such a path is requested.
> 
> Makes sense?
> 

(cc'ing David Howells since he did the original sb-sharing code for NFS
and may have an opinion here)

That sounds basically like what I'm saying. The tricky part is
fixing up the parent for the original '/a' when you reach it. To do
that, I think you'll also need to fix up cifs_lookup to call
d_materialise_unique instead of d_add.

This situation however is a bit different from NFS. With NFS, the
filehandle (and hence the inode) will be the same no matter how you
reach /a. It's possible though that cifs.ko will be manufacturing
inode numbers out of thin air.

So you may need some other mechanism to determine when you've reached a
"connection" to an existing mount like this, or come up with some way
to ensure that you always get the right inode when you do a lookup on
the same pathname.

-- 
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

      parent reply	other threads:[~2011-10-04 11:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26  6:52 [PATCH] CIFS: Fix NT_STATUS_ACCESS_DENIED for mounts with prefixpath option Pavel Shilovsky
     [not found] ` <1314341541-2476-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2011-08-26 11:34   ` Jeff Layton
     [not found]     ` <20110826073437.743c06a3-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-08-26 12:36       ` Pavel Shilovsky
2011-08-26 20:11       ` Pavel Shilovsky
     [not found]         ` <CAKywueQQMuTA=xszQYr6sf5L+cZ_s56qrCiL8MqthWS-Xbxw5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-26 21:23           ` Jeff Layton
2011-08-30 12:31   ` Pavel Shilovsky
     [not found]     ` <CAKywueRzwQPROzWTNwhbSOeEanV+Pumn=vFDmYL0uuEApfsX9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-30 12:59       ` Jeff Layton
     [not found]         ` <20110830085935.71e671e4-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-08-31 17:35           ` Pavel Shilovsky
     [not found]             ` <CAKywueSy2tFQC4mxOBZYjiY=PyLjUZ44v+qvtNNg+zKoxJmeCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-31 18:00               ` Jeff Layton
     [not found]                 ` <20110831140044.5ac4a691-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-08-31 18:27                   ` Pavel Shilovsky
2011-08-31 18:41                     ` Jeff Layton
     [not found]                       ` <20110831144152.788c2543-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-08-31 19:00                         ` Pavel Shilovsky
     [not found]                           ` <CAKywueQB=xM1Uv=HBpBwHSqbDcq43aBm4gYD_XbUahP9fyy9vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-31 19:22                             ` Jeff Layton
     [not found]                               ` <20110831152247.2f2cfcbd-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-10-04  9:01                                 ` Pavel Shilovsky
     [not found]                                   ` <CAKywueQ1shXsy1rSBJx1H7aD80wg-3=GbvKhLXHeH_nJRz3b2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-04 11:23                                     ` Jeff Layton [this message]

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=20111004072308.6010ecbc@tlielax.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@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