Package: smbfs Version: 1:3.0.28a-3 Severity: normal -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
When remounting a CIFS mount to change the byte-range locking option, the system reports success; but the system's behavior continues to reflect the originally-mounted choice. While researching http://bugs.debian.org/483216, i discovered that byte-range locks against files CIFS shares mounted with mount.cifs are normally interpreted as "mandatory" locks, instead of "advisory" locks. This is adjustable with the nobrl/brl mount options. mount claims to be able to successfully modify those options using -o remount, but in practice, the changed options don't seem to have any effect at all, and the option selected at initial mount time is the persistent behavior. In particular, locking a certain range of a file with a read lock and then locking the same range with a write lock gives an error when a CIFS share is mounted with "brl". This doesn't make much sense to me, but i'm willing to accept it as intended for now. I wrote a simple program (source attached) to test this locking behavior. I also observed that "brl" is translated into the "mand" option in the relevant line in /proc/mounts, and that "nobrl" maps to the *absence* of the "mand" option in the /proc/mounts entry. You can adjust the options reported in /proc/mounts using the standard "mount -o remount,newoptions" syntax, but the mountpoint's behavior does not change. Here's a transcript demonstrating the problem. "bob" is running the most recent version of samba available in debian etch. Note that the behavior of the "testlocking" program is not changed by the -o remount commands, even though /proc/mounts reflects the change: [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts [1 [EMAIL PROTECTED] ~]# mount -t cifs -o guest,uid=dkg,sec=none //bob/dmz /mnt [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts //bob/dmz /mnt cifs rw,mand,unc=\\bob\dmz,username=,uid=1000,posixpaths,rsize=16384,wsize=57344 0 0 [0 [EMAIL PROTECTED] ~]# touch /mnt/foo [0 [EMAIL PROTECTED] ~]# ~dkg/src/cmrg/test/testlocking/testlocking /mnt/foo write lock failed [1 [EMAIL PROTECTED] ~]# mount -o remount,nobrl,guest,uid=dkg,sec=none /mnt [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts //bob/dmz /mnt cifs rw,unc=\\bob\dmz,username=,uid=1000,posixpaths,rsize=16384,wsize=57344 0 0 [0 [EMAIL PROTECTED] ~]# ~dkg/src/cmrg/test/testlocking/testlocking /mnt/foo write lock failed [1 [EMAIL PROTECTED] ~]# umount /mnt [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts [1 [EMAIL PROTECTED] ~]# mount -t cifs -o nobrl,guest,uid=dkg,sec=none //bob/dmz /mnt [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts //bob/dmz /mnt cifs rw,unc=\\bob\dmz,username=,uid=1000,posixpaths,rsize=16384,wsize=57344 0 0 [0 [EMAIL PROTECTED] ~]# ~dkg/src/cmrg/test/testlocking/testlocking /mnt/foo [0 [EMAIL PROTECTED] ~]# mount -o remount,brl,guest,uid=dkg,sec=none /mnt [0 [EMAIL PROTECTED] ~]# grep /mnt /proc/mounts //bob/dmz /mnt cifs rw,mand,unc=\\bob\dmz,username=,uid=1000,posixpaths,rsize=16384,wsize=57344 0 0 [0 [EMAIL PROTECTED] ~]# ~dkg/src/cmrg/test/testlocking/testlocking /mnt/foo [0 [EMAIL PROTECTED] ~]# Thanks for maintaining samba packages in debian! Let me know if i can help debug further. --dkg [0] http://cmrg.fifthhorseman.net/browser/trunk/test/testlocking/testlocking.c - -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing'), (200, 'unstable'), (101, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages smbfs depends on: ii libc6 2.7-10 GNU C Library: Shared libraries ii netbase 4.32 Basic TCP/IP networking system ii samba-common 1:3.0.28a-3 Samba common files used by both th smbfs recommends no packages. - -- no debconf information -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQIVAwUBSD4rTMzS7ZTSFznpAQIAlA/8D1AIGKTtIdR4wXYj6oj/VULGixDT1oLK IZu3nNpx5E8yglplA4HqaodwUw6otc6orrUJxiZ5ZXB8rEx1XEZlMM+we2yVlbMC hak4FJ2IGGee7XZjzdC5iTGLxO5O3vKlfGBUolK4uBdbZqbAV7M7GklkpEsEgVYE KDNDBWwUHT4xvBaH9GhqMkPZsSHIZRo6jQ+hQ6eFUrNlEvN9mPwh5mEc1PsGe5gl RjO+j5lUhZJX+ARzQOqrl6Z9rJN+DzQ7i2RMx9AnlM0AKICcAYQjNCDelfHAB6pe u4od64XGOmyxJAYzQt5O1POpYQrsOBrZuH0h3IMYrG8mNmKHKGmgmNcPc23llUQq +Sjw9FRPVrZap4KO1VBxDoZsMfxjLR6vGLNXtXVjWMXR9zFJJN4WsP/rWBZ1qM1i HCvR0bWaF6WAYVTpTEQsrQxUM+/2cD5iLRY6cCrv2kZxVRgjgMWIBGM5/yqX/b5w lkk7zBm5Quja5iMii9G0ZNbjijypwkP8IISa6/T/KVlbWzklDbiozGCT2damPlZN s3NvfLAD9bRgCPdcq+kEbHs5LZmyMoBZEukNp80OzbL6DZTipEtHyOhdS+25grSr e7IsAYi7D7fScnbFzURDDH9CKuWh75nHO5xSnxE2fUPl9lLqAccqREKi2yZZpw81 TPzLHm+REVw= =5HK4 -----END PGP SIGNATURE-----
/* grep open(2) for O_LARGEFILE to explain this: */ #define _FILE_OFFSET_BITS 64 #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <stdio.h> /* Author: Daniel Kahn Gillmor <[EMAIL PROTECTED]> Date: 2008-05-28 This is a demonstration program for testing http://bugs.debian.org/483216 */ int main(int argc, char* argv[]) { struct flock flock; int fd; flock.l_whence=SEEK_SET; /* open file, get file descriptor */ fd = open(argv[1], O_RDWR|O_CREAT, 0644); fcntl(fd, F_SETFD, FD_CLOEXEC | fcntl(fd, F_GETFD)); /* get read lock: */ flock.l_type=F_RDLCK; flock.l_start=0; flock.l_len = 1; if (0 != fcntl(fd, F_SETLK64, &flock)) { fprintf(stderr, "read lock failed\n"); return 1; } /* get write lock for same range: */ flock.l_type=F_WRLCK; if (0 != fcntl(fd, F_SETLK64, &flock)) { /* fails here when used on CIFS share mounted without nobrl option */ fprintf(stderr, "write lock failed\n"); return 1; } return 0; }

