Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel-IBi9RG/b67k@public.gmane.org>
To: Shirish Pargaonkar
	<shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v1] cifs: make shares unaccessible at root level mountable
Date: Thu, 26 Nov 2015 14:09:15 +0100	[thread overview]
Message-ID: <20151126140915.11349031@aaptelpc> (raw)
In-Reply-To: <CADT32eJ_uLj4_sEhWc+O=xjOMMfNhGGH9XhiJmdDQyrL6Dzp3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2718 bytes --]

On Mon, 16 Nov 2015 23:20:09 -0600 Shirish Pargaonkar
<shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I do not understand why you need to entertain error ENOENT on an
> intermediate path.

In cifs_get_root() @ fs/cifs/cifsfs.c when one of the intermediary path
component access is restricted I get a NULL direntry->d_inode. Which is
translated to ENOENT.

		struct inode *dir = d_inode(dentry);
		struct dentry *child;

		if (!dir) {
			dput(dentry);
			dentry = ERR_PTR(-ENOENT);
			break;
		}


> I still do not understand why noserverino is in picture. Only the
> disconnected root dentry
> has an inode generated with an id by the cifs client.  Once this
> disconnected root denty
> gets spliced, the inode is filled with correct inode (fileid)
> available from the server
> (since that intermediate path is now accessible hence splicable).
> You have fileid/inode available for all eligible/accessible file
> objects under the disconnected
> root entry.

Again, the only function that adds disconneted roots
to the linked list in the superblock is cifs_alloc_rdelem() which is
*only called* with noserverino. This is from your patch.

% grep -R cifs_alloc_rdelem fs/cifs/*.c
fs/cifs/cifsfs.c-}
fs/cifs/cifsfs.c-
fs/cifs/cifsfs.c-struct cifs_rdelem *
fs/cifs/cifsfs.c:cifs_alloc_rdelem(char *full_path, struct dentry *rdentry,
fs/cifs/cifsfs.c-                               struct inode *rdinode)
fs/cifs/cifsfs.c-{
fs/cifs/cifsfs.c-       struct cifs_rdelem *rdelem;
--
fs/cifs/cifsfs.c-               if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
fs/cifs/cifsfs.c-
fs/cifs/cifsfs.c-                       rdelem =
fs/cifs/cifsfs.c:                               cifs_alloc_rdelem(fpath, dentry, rinode);
fs/cifs/cifsfs.c-                       if (IS_ERR(rdelem))
fs/cifs/cifsfs.c-                               goto rdelem_ret;
fs/cifs/cifsfs.c-                       spin_lock(&cifs_sb->rtdislock);

To properly build a path from a child dentry of a disconnected root you need to know the path of the disconnected root and use it as a prefix. This prefix is only stored in the rdelem struct which is only used with noserverino. See above.

My patch was able to fix several SUSE customers problems and people contacted me off-list to tell me it also fixed his problem. I cannot reproduce the issue you're describing.

We can talk on irc if you want, I'm aaptel on freenode.

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG
Nürnberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-11-26 13:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 14:48 [PATCH v1] cifs: make shares unaccessible at root level mountable Aurélien Aptel
2015-11-17  5:20 ` Shirish Pargaonkar
     [not found]   ` <CADT32eJ_uLj4_sEhWc+O=xjOMMfNhGGH9XhiJmdDQyrL6Dzp3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-26 13:09     ` Aurélien Aptel [this message]
2015-11-30  6:54       ` Shirish Pargaonkar

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=20151126140915.11349031@aaptelpc \
    --to=aaptel-ibi9rg/b67k@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@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