[linux-cifs-client] Permissions disappearing on CIFS mounted share.

Eisenhut, Daniel (GE Healthcare) Daniel.Eisenhut at med.ge.com
Wed Nov 30 19:13:52 GMT 2005


Thanks, looks like I'll have to dig into the code a bit to test these
ideas out.
 
One other observation that may be of interest...  When running the
untarring from within a script (one of those that I gave execute
permission to), that particular script and any that called it (and
therefore open) do not lose their execute permissions.
 
Using my example below, I can duplicate this by doing:
 
# mkdir cifs test
# mount -t cifs -o user=xxxxx,dom=xxxxx,uid=root,gid=root,file_mode=0664
//server.domain/share cifs
# chmod a+x cifs/file1 cifs/file2
# cat > cifs/file1 &
# cd test
# tar jxf ../cifs/tarball.bz2

This causes file1 to be held open.  In this case, only file2 loses it's
execute permissions.

Dan

________________________________

From: Steven French [mailto:sfrench at us.ibm.com] 
Sent: Wednesday, November 30, 2005 11:59 AM
To: Eisenhut, Daniel (GE Healthcare)
Cc: linux-cifs-client at lists.samba.org
Subject: Re: [linux-cifs-client] Permissions disappearing on CIFS
mounted share.



Two possible triggers for this behavior worth looking at:
1) memory pressure causing the dentry and dentry->d_inode to be freed
(the mode bits are cached in the inmemory inode on the client while it
stays in memory) - when it gets reloaded it will be reset back to the
default for the mount
2) readdir vs. stat/lookup - I think all of these type of cases (where
mode could get overwritten) are fixed, but I have had to be careful that
readdir (which can refresh inode info such as size) does not refresh
mode unless it is a new inode. Similarly a second lookup should not
reset the mode for existing in memory inode

Long term, when the sfu mount option is specified - the client will map
the 0777 bits to Windows ACLs (not just the 3 bits above that), but at
the moment I am swamped trying to finish up the 1.39 cifs testing

Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench at-sign us dot ibm dot com

"Eisenhut, Daniel (GE Healthcare)" <Daniel.Eisenhut at med.ge.com> 
Sent by: linux-cifs-client-bounces+sfrench=us.ibm.com at lists.samba.org 
11/30/2005 11:44 AM
To <linux-cifs-client at lists.samba.org>	
cc
Subject [linux-cifs-client] Permissions disappearing on CIFS mounted
share.	
	 	

I'm having a weird problem that hopefully someone here can help with...

On a WinXP laptop, I share a directory and place a large 170MB tarball
(tarball.bz2) in it and a couple of text files (file1 and file2).  Then
on my Linux box I do the following:

# mkdir cifs test
# mount -t cifs -o user=xxxxx,dom=xxxxx,uid=root,gid=root,file_mode=0664
//server.domain/share cifs
# chmod a+x cifs/file1 cifs/file2
# cd test
# tar jxf ../cifs/tarball.bz2

Halfway through the untarring, the "x" permission on the two other files
disappear.  Doing this many times and looking at the statistics (in
/proc/fs/cifs/Stats), it always seems to do it after about 20000 reads.
I've tried compiling the cifs kernel module with "extended attributes"
and "POSIX Extensions", but no change.  Using smbfs and fmask=0644, the
problem doesn't exist since a chmod seems to have no effect so I can't
set the execute permissions.

I need to add execute permissions to a directory with a bunch of bash
scripts.  But I cannot just change the file_mode to 775 because other
things, such as modules-update, will fail if execute is on files where
it shouldn't be.  My problem occurs because the scripts call each other
and suddenly they don't have permission to anymore.

I tried to enable cifsFYI or traceSMB, but there is just too much to dig
through.  Is anyone familiar with this?  Some kind of synronization with
the server that occurs after a certain amount of traffic and resets the
permissions to what they were originally?

My Linux box is running Gentoo (periodically updated with emerge) with
2.6.14-gentoo kernel and 3.0.14a-r2 of Samba installed.  Windows box
info from /proc/fs/cifs/DebugData:

Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 1.35
Servers:
1) Name: x.x.x.x  Domain: xxxxxx Mounts: 1 ServerOS: Windows 5.1  
ServerNOS: Windows 2000 LAN Manager Capabilities: 0xe3fd
SMB session status: 1 TCP status: 1
Local Users To Server: 1 SecMode: 0x3 Req Active: 0
MIDs:

Shares:
1) \\xxxxxxx\Test Uses: 1 Type: NTFS Characteristics: 0x20 Attributes:
0x700ff
PathComponentMax: 255 Status: 1 type: DISK

Thanks,
Dan



More information about the linux-cifs-client mailing list