Re: [PATCH v1] cifs: make shares unaccessible at root level mountable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 26, 2015 at 7:09 AM, Aurélien Aptel <aaptel@xxxxxxxx> wrote:
> On Mon, 16 Nov 2015 23:20:09 -0600 Shirish Pargaonkar
> <shirishpargaonkar@xxxxxxxxx> 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;
>                 }
>
>

So only time you will have NULL dir (inode) is when lookup_one_len()
in cifs_get_root() returned a negative dentry. If we call
create_root_dis_dentry()
for a path object which already has a negative dentry, we will create another
dentry (disconnected) for the same path object.  So for the same path object, we
could possibly have two (or more) dentries in the dentry cache, one
negative and one
(or more) disconnected.  So I think if we are going to call
create_root_dis_dentry()
in case error is ENONET, we should delete the (negative) dentry before the call.

>> 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)
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux