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

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

 



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;
		}


> 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: pgpDVSKcXudoU.pgp
Description: OpenPGP digital signature


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

  Powered by Linux