[linux-cifs-client] file creation fails with unix extensions and forced uid/gid

Uri Simchoni uri_simchoni at hotmail.com
Sun Jan 18 11:36:40 GMT 2009


Hi,
 
I'm using linux vanilla kernel 2.6.28 and am mounting from my machine to a
samba server. Since we don't have common uid/gid database, I'm using the
uid= and gid= parameters when mounting.

so the mount command (as root) is:
mount -t cifs //<ip>/<share> /mnt -o
user=<user>,pass=<pass>,uid=<client_uid>,gid=<client_gid>

I'm mounting as root, but then try to copy files as a user (the user that
has the mount's uid/gid)
I've noticed an odd thing - if I mkdir on the mounted directory and right
after that create a file (as in "cp -r mydir /mnt/mycifsmount/" ) then the
file creation fails.
If I wait a few seconds after mkdir, the create works.
 
I think what happen is this:
- During mkdir, the created inode doesn't have the client uid/gid (since
cifs_unix_info_to_inode() is called with force_uid_gid set to one)
- The dentry and its inode are kept in a cache, so subsequent access to this
directory gets the inode with server uid/gid
- If I wait a few seconds, the cache entry expires and normal reading of the
directory creates an inode with client uid/gid
 
I'm not sure why we want to have an inode with server uid/gid in the first
place, so I'm not sure what is the correct patch.
 
Please advise.
 
Thanks,
 
Uri.

-- 
View this message in context: http://www.nabble.com/file-creation-fails-with-unix-extensions-and-forced-uid-gid-tp21526798p21526798.html
Sent from the Samba - linux-cifs-client mailing list archive at Nabble.com.



More information about the linux-cifs-client mailing list