[linux-cifs-client] mkdir -p problem

Günter Kukkukk linux at kukkukk.com
Fri Feb 27 18:21:57 GMT 2009


Am Donnerstag, 26. Februar 2009 schrieb Pavel Shilovsky:
> Hello!
> 
> I have such a situation.
> 
> I mount samba share with uid options and try to exec mkdir command. I have 
> that cifs driver don't set uid during the one second - that's why i have a 
> problem with creating hierarchy of directories. Cifs creates the first 
> directory and when it try to create the second in it gets permission denied 
> because driver don't set uid that I chose during mounting.
> 
> I looked on the code and found such an interesting thing:
> when driver create directory, it calls posix_fill_in_inode() function that 
> calls cifs_unix_info_to_inode() with force_uid_gid = 1 - driver don't set 
> mnt_uid and mnt_gid after creating even if they were chosen.
> 
> That's why when I tried to "mkdir -p 1/2/3" in root share directory it failed.
> 
> I patched it with:
> 
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 9c548f1..e02de2b 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -843,7 +843,7 @@ static void posix_fill_in_inode(struct inode *tmp_inode,
>         local_mtime = tmp_inode->i_mtime;
>         local_size  = tmp_inode->i_size;
> 
> -       cifs_unix_info_to_inode(tmp_inode, pData, 1);
> +       cifs_unix_info_to_inode(tmp_inode, pData, 0);
>         cifs_set_ops(tmp_inode, false);
> 
>         if (!S_ISREG(tmp_inode->i_mode))
> 
> and mkdir -p worked successful. Is it a bug or there are some other reason to 
> do this?
> 

you haven't mentioned the version of cifs vfs you are running.
'modinfo cifs' will tell.

Cheers, Günter


More information about the linux-cifs-client mailing list