Re: [Samba] oplocks issue when trying to copy file

2011-12-19 Thread Joschi Brauchle

I reported the issue here:
https://bugzilla.samba.org/show_bug.cgi?id=8670

Please find level-10 logs and strace there.

Best regards,
Joschi Brauchle

On 12/19/2011 10:57 AM, Volker Lendecke wrote:

Hi!

More interesting would be a debug level 10 logfile together
with a "strace -ttT -o /tmp/smbd.strace -p" on
the smbd relevant for the client.

Volker

On Fri, Dec 16, 2011 at 06:44:10PM +0100, Joschi Brauchle wrote:

Hello everyone,

I would like to follow up on the thread "[Samba] oplocks issue when
trying to copy file", which I found while googling for a problem.

We have the same setup and problem mentioned in that thread:
Our Samba server (version 3.5.12) exports a share that was mounted
via NFS from another machine. We are using SUSE Linux Enterprise and
this setup used to work with "kernel oplocks = yes" in SLES10, but
not in SLES11SP1.

I did some research and found that the kernel commit
http://kernel.opensuse.org/cgit/kernel/commit/?h=SLE11-SP1&id=dd143426eaaadea159c8dd2d3c9ff5e9da94bcfd
mentioned in this thread is included in SLES11SP1 kernel 2.6.32.29.

So I downgraded to SLES11SP1 2.6.32.12 on a test-machine and can
confirm that the problem goes away with kernel oplocks turned on!

As a workaround, one can disable kernel oplocks or use the "-o
nolock" option when mounting via NFS.

I guess this kernel regression should be reported to Novell. I can
provide the samba-level-10 logfiles for 2.6.32.12 (working) and
2.6.32.29 (not working).

Best regards,   
--
Dipl.-Ing. Joschi Brauchle, M.Sc.

Institute for Communications Engineering (LNT)
Technische Universitaet Muenchen (TUM)
80290 Munich, Germany

Tel (work): +49 89 289-23474
Fax (work): +49 89 289-23490
E-mail: joschi.brauc...@tum.de
Web: http://www.lnt.ei.tum.de/





--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba





--
Dipl.-Ing. Joschi Brauchle, M.Sc.

Institute for Communications Engineering (LNT)
Technische Universitaet Muenchen (TUM)
80290 Munich, Germany

Tel (work): +49 89 289-23474
Fax (work): +49 89 289-23490
E-mail: joschi.brauc...@tum.de
Web: http://www.lnt.ei.tum.de/

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Re: [Samba] oplocks issue when trying to copy file

2011-12-19 Thread Volker Lendecke
Hi!

More interesting would be a debug level 10 logfile together
with a "strace -ttT -o /tmp/smbd.strace -p " on
the smbd relevant for the client.

Volker

On Fri, Dec 16, 2011 at 06:44:10PM +0100, Joschi Brauchle wrote:
> Hello everyone,
> 
> I would like to follow up on the thread "[Samba] oplocks issue when
> trying to copy file", which I found while googling for a problem.
> 
> We have the same setup and problem mentioned in that thread:
> Our Samba server (version 3.5.12) exports a share that was mounted
> via NFS from another machine. We are using SUSE Linux Enterprise and
> this setup used to work with "kernel oplocks = yes" in SLES10, but
> not in SLES11SP1.
> 
> I did some research and found that the kernel commit
> http://kernel.opensuse.org/cgit/kernel/commit/?h=SLE11-SP1&id=dd143426eaaadea159c8dd2d3c9ff5e9da94bcfd
> mentioned in this thread is included in SLES11SP1 kernel 2.6.32.29.
> 
> So I downgraded to SLES11SP1 2.6.32.12 on a test-machine and can
> confirm that the problem goes away with kernel oplocks turned on!
> 
> As a workaround, one can disable kernel oplocks or use the "-o
> nolock" option when mounting via NFS.
> 
> I guess this kernel regression should be reported to Novell. I can
> provide the samba-level-10 logfiles for 2.6.32.12 (working) and
> 2.6.32.29 (not working).
> 
> Best regards, 
> -- 
> Dipl.-Ing. Joschi Brauchle, M.Sc.
> 
> Institute for Communications Engineering (LNT)
> Technische Universitaet Muenchen (TUM)
> 80290 Munich, Germany
> 
> Tel (work): +49 89 289-23474
> Fax (work): +49 89 289-23490
> E-mail: joschi.brauc...@tum.de
> Web: http://www.lnt.ei.tum.de/
> 


> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba


-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-37-0, fax: +49-551-37-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kont...@sernet.de
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] oplocks issue when trying to copy file

2011-10-24 Thread Philip Ong
I don't have a linux vendor. We compile kernel.org kernel on top of Centos 5.x. 
kernel.org is still under construction so I'm not able to submit a bug. Any 
other suggestions?

-Original Message-
From: Jeremy Allison [mailto:j...@samba.org] 
Sent: Monday, October 24, 2011 5:36 PM
To: Jeremy Allison
Cc: Philip Ong; 'samba@lists.samba.org'
Subject: Re: [Samba] oplocks issue when trying to copy file

On Mon, Oct 24, 2011 at 05:35:01PM -0700, Jeremy Allison wrote:
> On Wed, Oct 19, 2011 at 11:33:32PM -0700, Philip Ong wrote:
> > I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> > replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The 
> > problem is I'm not sure if Samba needs to be fixed or the kernel needs to 
> > be. Anyone know what the right action is? One thing I noticed was the 
> > invalid argument being sent in the debugging log.
> > 
> > "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, 
> > fd = 33, file_id = 17:aa41ab:0. (Invalid argument)"
> > 
> > Any advice would help.
> > 
> > Thanks,
> > Phil
> > 
> > 
> > The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> > regression (failure to find conflicts)) fixed the posix_test_lock()
> > function by itself, however, its usage in NFS changed by the commit
> > 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> > same interface as ->lock) remained broken - subsequent NFS-specific
> > locking code received F_UNLCK instead of the user-specified lock type.
> > To fix the problem, fl->fl_type needs to be saved before the
> > posix_test_lock() call and restored if no local conflicts were reported.
> 
> Looking closer at the problem...
> 
> We simply call fcntl(fd, F_SETLEASE, leasetype) on a fd to
> get a kernel oplock on it.
> 
> int leasetype can be F_WRLCK or F_UNLCK (from Samba). This
> matches the fcntl F_SETLEASE documentation completely. There
> has been no change whatsoever in Samba in this regard.
> 
> So I'm definitely calling kernel regression bug on this one.

FYI. Can you help me by logging a bug with your Linux
vendor on this one so we can get this fixed please ?

Jeremy.
---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] oplocks issue when trying to copy file

2011-10-24 Thread Jeremy Allison
On Mon, Oct 24, 2011 at 05:35:01PM -0700, Jeremy Allison wrote:
> On Wed, Oct 19, 2011 at 11:33:32PM -0700, Philip Ong wrote:
> > I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> > replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The 
> > problem is I'm not sure if Samba needs to be fixed or the kernel needs to 
> > be. Anyone know what the right action is? One thing I noticed was the 
> > invalid argument being sent in the debugging log.
> > 
> > "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, 
> > fd = 33, file_id = 17:aa41ab:0. (Invalid argument)"
> > 
> > Any advice would help.
> > 
> > Thanks,
> > Phil
> > 
> > 
> > The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> > regression (failure to find conflicts)) fixed the posix_test_lock()
> > function by itself, however, its usage in NFS changed by the commit
> > 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> > same interface as ->lock) remained broken - subsequent NFS-specific
> > locking code received F_UNLCK instead of the user-specified lock type.
> > To fix the problem, fl->fl_type needs to be saved before the
> > posix_test_lock() call and restored if no local conflicts were reported.
> 
> Looking closer at the problem...
> 
> We simply call fcntl(fd, F_SETLEASE, leasetype) on a fd to
> get a kernel oplock on it.
> 
> int leasetype can be F_WRLCK or F_UNLCK (from Samba). This
> matches the fcntl F_SETLEASE documentation completely. There
> has been no change whatsoever in Samba in this regard.
> 
> So I'm definitely calling kernel regression bug on this one.

FYI. Can you help me by logging a bug with your Linux
vendor on this one so we can get this fixed please ?

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] oplocks issue when trying to copy file

2011-10-24 Thread Jeremy Allison
On Wed, Oct 19, 2011 at 11:33:32PM -0700, Philip Ong wrote:
> I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The problem 
> is I'm not sure if Samba needs to be fixed or the kernel needs to be. Anyone 
> know what the right action is? One thing I noticed was the invalid argument 
> being sent in the debugging log.
> 
> "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd 
> = 33, file_id = 17:aa41ab:0. (Invalid argument)"
> 
> Any advice would help.
> 
> Thanks,
> Phil
> 
> 
> The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> regression (failure to find conflicts)) fixed the posix_test_lock()
> function by itself, however, its usage in NFS changed by the commit
> 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> same interface as ->lock) remained broken - subsequent NFS-specific
> locking code received F_UNLCK instead of the user-specified lock type.
> To fix the problem, fl->fl_type needs to be saved before the
> posix_test_lock() call and restored if no local conflicts were reported.

Looking closer at the problem...

We simply call fcntl(fd, F_SETLEASE, leasetype) on a fd to
get a kernel oplock on it.

int leasetype can be F_WRLCK or F_UNLCK (from Samba). This
matches the fcntl F_SETLEASE documentation completely. There
has been no change whatsoever in Samba in this regard.

So I'm definitely calling kernel regression bug on this one.

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] oplocks issue when trying to copy file

2011-10-24 Thread Jeremy Allison
On Fri, Oct 21, 2011 at 01:16:00PM -0700, Philip Ong wrote:
> I also tried 3.6.1 and it still has the issue
> 
> -Original Message-
> From: Michael Wood [mailto:esiot...@gmail.com] 
> Sent: Friday, October 21, 2011 12:09 AM
> To: Philip Ong
> Cc: samba@lists.samba.org; samba-techni...@lists.samba.org
> Subject: Re: [Samba] oplocks issue when trying to copy file
> 
> Try the samba-technical list.
> 
> On 20 October 2011 08:33, Philip Ong  wrote:
> > I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> > replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The 
> > problem is I'm not sure if Samba needs to be fixed or the kernel needs to 
> > be. Anyone know what the right action is? One thing I noticed was the 
> > invalid argument being sent in the debugging log.
> >
> > "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, 
> > fd = 33, file_id = 17:aa41ab:0. (Invalid argument)"
> >
> > Any advice would help.

Hmmm. As the Samba code hasn't changed here w.r.t. requesting
kernel oplocks it looks like a kernel regression to me.

Jeremy.
-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


Re: [Samba] oplocks issue when trying to copy file

2011-10-21 Thread Philip Ong
I also tried 3.6.1 and it still has the issue

-Original Message-
From: Michael Wood [mailto:esiot...@gmail.com] 
Sent: Friday, October 21, 2011 12:09 AM
To: Philip Ong
Cc: samba@lists.samba.org; samba-techni...@lists.samba.org
Subject: Re: [Samba] oplocks issue when trying to copy file

Try the samba-technical list.

On 20 October 2011 08:33, Philip Ong  wrote:
> I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The problem 
> is I'm not sure if Samba needs to be fixed or the kernel needs to be. Anyone 
> know what the right action is? One thing I noticed was the invalid argument 
> being sent in the debugging log.
>
> "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd 
> = 33, file_id = 17:aa41ab:0. (Invalid argument)"
>
> Any advice would help.
>
> Thanks,
> Phil
>
>
> The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> regression (failure to find conflicts)) fixed the posix_test_lock()
> function by itself, however, its usage in NFS changed by the commit
> 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> same interface as ->lock) remained broken - subsequent NFS-specific
> locking code received F_UNLCK instead of the user-specified lock type.
> To fix the problem, fl->fl_type needs to be saved before the
> posix_test_lock() call and restored if no local conflicts were reported.
>
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
> Tested-by: Alexander Morozov 
> Signed-off-by: Sergey Vlasov 
> Signed-off-by: Trond Myklebust 
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Andi Kleen 
>
> ---
> fs/nfs/file.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> Index: linux-2.6.35.y/fs/nfs/file.c
> ===
> --- linux-2.6.35.y.orig/fs/nfs/file.c
> +++ linux-2.6.35.y/fs/nfs/file.c
> @@ -696,6 +696,7 @@ static int do_getlk(struct file *filp, i
> {
> struct inode *inode = filp->f_mapping->host;
> int status = 0;
> +       unsigned int saved_type = fl->fl_type;
>
> /* Try local locking first */
> posix_test_lock(filp, fl);
> @@ -703,6 +704,7 @@ static int do_getlk(struct file *filp, i
> /* found a conflict */
> goto out;
> }
> +       fl->fl_type = saved_type;
>
> if (nfs_have_delegation(inode, FMODE_READ))
> goto out_noconflict;
> --
>
> -Original Message-
> From: Philip Ong
> Sent: Tuesday, September 27, 2011 10:41 PM
> To: samba@lists.samba.org
> Cc: Philip Ong
> Subject: oplocks issue when trying to copy file
>
> I'm not sure if this a Kernel/samba or NFS issue. We run this on Centos 5.6 
> using a kernel.org kernel.
>
> Please find below the problem description
>
> When trying to copy a file to a samba share which has NFS backend on 2.6.36.3 
> or newer Linux kernel following message is displayed on windows client
>
> "An unexpected error is keeping you from copying the file. If you continue to 
> receive this error, you can use the error code to search for help with this 
> problem.
> Error 0x80070021: The process cannot access the file because another process 
> has locked a portion of the file"
>
> I am able to delete a file within the same directory structure. I am also 
> able to create a file or folder by right-clicking within Windows Explorer on 
> XP. Below are the logs generated by samba in debug mode. The main line of 
> interest was:
>
>  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
> 33, file_id = 17:aa41ab:0. (Invalid argument)
>
>
> Please note "test.cfg" was the file which we were trying to copy from windows
>
>  check_reduced_name [home/foo/open/test.cfg] [/]
> [2011/09/27 17:41:41.128330, 10] smbd/vfs.c:968(check_reduced_name)
>  check_reduced_name realpath [home/foo/open/test.cfg] -> 
> [/home/foo/open/test.cfg]
> [2011/09/27 17:41:41.128339,  3] smbd/vfs.c:1038(check_reduced_name)
>  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
> [2011/09/27 17:41:41.128348, 10] smbd/open.c:3414(create_file_default)
>  create_file: access_mask = 0x6019f file_attributes = 0x20, share_access = 
> 0x0, create_disposition = 0x2 create_options = 0x44 oplock_request
> = 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), fname = 
> home/foo/open/test.cfg
> [2011/09/27 17:41:41.128359,  3] smbd/vfs.c:881(check_reduced_name)
>  check_reduced_name [home/foo/open/test.cfg] [/]
> [2011/09/27 17:41:41.128377, 10] smbd/vfs.c:968(check_reduced_name)
>  check_reduced_name realpath [home/foo/open/test.cfg] -> 
> [/home/f

Re: [Samba] oplocks issue when trying to copy file

2011-10-21 Thread Michael Wood
Try the samba-technical list.

On 20 October 2011 08:33, Philip Ong  wrote:
> I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
> replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The problem 
> is I'm not sure if Samba needs to be fixed or the kernel needs to be. Anyone 
> know what the right action is? One thing I noticed was the invalid argument 
> being sent in the debugging log.
>
> "  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd 
> = 33, file_id = 17:aa41ab:0. (Invalid argument)"
>
> Any advice would help.
>
> Thanks,
> Phil
>
>
> The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
> regression (failure to find conflicts)) fixed the posix_test_lock()
> function by itself, however, its usage in NFS changed by the commit
> 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
> same interface as ->lock) remained broken - subsequent NFS-specific
> locking code received F_UNLCK instead of the user-specified lock type.
> To fix the problem, fl->fl_type needs to be saved before the
> posix_test_lock() call and restored if no local conflicts were reported.
>
> Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
> Tested-by: Alexander Morozov 
> Signed-off-by: Sergey Vlasov 
> Signed-off-by: Trond Myklebust 
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Andi Kleen 
>
> ---
> fs/nfs/file.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> Index: linux-2.6.35.y/fs/nfs/file.c
> ===
> --- linux-2.6.35.y.orig/fs/nfs/file.c
> +++ linux-2.6.35.y/fs/nfs/file.c
> @@ -696,6 +696,7 @@ static int do_getlk(struct file *filp, i
> {
> struct inode *inode = filp->f_mapping->host;
> int status = 0;
> +       unsigned int saved_type = fl->fl_type;
>
> /* Try local locking first */
> posix_test_lock(filp, fl);
> @@ -703,6 +704,7 @@ static int do_getlk(struct file *filp, i
> /* found a conflict */
> goto out;
> }
> +       fl->fl_type = saved_type;
>
> if (nfs_have_delegation(inode, FMODE_READ))
> goto out_noconflict;
> --
>
> -Original Message-
> From: Philip Ong
> Sent: Tuesday, September 27, 2011 10:41 PM
> To: samba@lists.samba.org
> Cc: Philip Ong
> Subject: oplocks issue when trying to copy file
>
> I'm not sure if this a Kernel/samba or NFS issue. We run this on Centos 5.6 
> using a kernel.org kernel.
>
> Please find below the problem description
>
> When trying to copy a file to a samba share which has NFS backend on 2.6.36.3 
> or newer Linux kernel following message is displayed on windows client
>
> "An unexpected error is keeping you from copying the file. If you continue to 
> receive this error, you can use the error code to search for help with this 
> problem.
> Error 0x80070021: The process cannot access the file because another process 
> has locked a portion of the file"
>
> I am able to delete a file within the same directory structure. I am also 
> able to create a file or folder by right-clicking within Windows Explorer on 
> XP. Below are the logs generated by samba in debug mode. The main line of 
> interest was:
>
>  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
> 33, file_id = 17:aa41ab:0. (Invalid argument)
>
>
> Please note "test.cfg" was the file which we were trying to copy from windows
>
>  check_reduced_name [home/foo/open/test.cfg] [/]
> [2011/09/27 17:41:41.128330, 10] smbd/vfs.c:968(check_reduced_name)
>  check_reduced_name realpath [home/foo/open/test.cfg] -> 
> [/home/foo/open/test.cfg]
> [2011/09/27 17:41:41.128339,  3] smbd/vfs.c:1038(check_reduced_name)
>  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
> [2011/09/27 17:41:41.128348, 10] smbd/open.c:3414(create_file_default)
>  create_file: access_mask = 0x6019f file_attributes = 0x20, share_access = 
> 0x0, create_disposition = 0x2 create_options = 0x44 oplock_request
> = 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), fname = 
> home/foo/open/test.cfg
> [2011/09/27 17:41:41.128359,  3] smbd/vfs.c:881(check_reduced_name)
>  check_reduced_name [home/foo/open/test.cfg] [/]
> [2011/09/27 17:41:41.128377, 10] smbd/vfs.c:968(check_reduced_name)
>  check_reduced_name realpath [home/foo/open/test.cfg] -> 
> [/home/foo/open/test.cfg]
> [2011/09/27 17:41:41.128386,  3] smbd/vfs.c:1038(check_reduced_name)
>  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
> [2011/09/27 17:41:41.128394, 10] smbd/open.c:2941(create_file_unixpath)
>  create_file_unixpath: access_mask = 0x6019f file_attributes = 0x20, 
> share_access = 0x0, create_disposition = 0x2 create_options = 0x44 oplock
> _request = 0x3 ea_list = 0x(nil), sd = 0x(nil), fname = home/foo/open/test.cfg
> [2011/09/27 17:41:41.128406,  5] smbd/files.c:119(file_new)
>  allocated file structure 14342, fnum = 18438 (4 used)
> [2011/09/27 17:41:41.128416,  3] smbd/dosmode.c:166(unix_mode)
>  unix_mode(home/foo/open/

Re: [Samba] oplocks issue when trying to copy file

2011-10-19 Thread Philip Ong
I've narrowed this problem down to a patch that is applied in 2.6.36.3. I 
replaced file.c from 2.6.36.2 into 2.6.36.3 and Samba works fine. The problem 
is I'm not sure if Samba needs to be fixed or the kernel needs to be. Anyone 
know what the right action is? One thing I noticed was the invalid argument 
being sent in the debugging log.

"  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
33, file_id = 17:aa41ab:0. (Invalid argument)"

Any advice would help.

Thanks,
Phil


The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK
regression (failure to find conflicts)) fixed the posix_test_lock()
function by itself, however, its usage in NFS changed by the commit
9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock
same interface as ->lock) remained broken - subsequent NFS-specific
locking code received F_UNLCK instead of the user-specified lock type.
To fix the problem, fl->fl_type needs to be saved before the
posix_test_lock() call and restored if no local conflicts were reported.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
Tested-by: Alexander Morozov 
Signed-off-by: Sergey Vlasov 
Signed-off-by: Trond Myklebust 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Andi Kleen 

---
fs/nfs/file.c | 2 ++
1 file changed, 2 insertions(+)

Index: linux-2.6.35.y/fs/nfs/file.c
===
--- linux-2.6.35.y.orig/fs/nfs/file.c
+++ linux-2.6.35.y/fs/nfs/file.c
@@ -696,6 +696,7 @@ static int do_getlk(struct file *filp, i
{
struct inode *inode = filp->f_mapping->host;
int status = 0;
+   unsigned int saved_type = fl->fl_type;

/* Try local locking first */
posix_test_lock(filp, fl);
@@ -703,6 +704,7 @@ static int do_getlk(struct file *filp, i
/* found a conflict */
goto out;
}
+   fl->fl_type = saved_type;

if (nfs_have_delegation(inode, FMODE_READ))
goto out_noconflict;
--

-Original Message-
From: Philip Ong 
Sent: Tuesday, September 27, 2011 10:41 PM
To: samba@lists.samba.org
Cc: Philip Ong
Subject: oplocks issue when trying to copy file 

I'm not sure if this a Kernel/samba or NFS issue. We run this on Centos 5.6 
using a kernel.org kernel.

Please find below the problem description

When trying to copy a file to a samba share which has NFS backend on 2.6.36.3 
or newer Linux kernel following message is displayed on windows client 

"An unexpected error is keeping you from copying the file. If you continue to 
receive this error, you can use the error code to search for help with this 
problem.
Error 0x80070021: The process cannot access the file because another process 
has locked a portion of the file"

I am able to delete a file within the same directory structure. I am also able 
to create a file or folder by right-clicking within Windows Explorer on XP. 
Below are the logs generated by samba in debug mode. The main line of interest 
was:

  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
33, file_id = 17:aa41ab:0. (Invalid argument)


Please note "test.cfg" was the file which we were trying to copy from windows

  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128330, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128339,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128348, 10] smbd/open.c:3414(create_file_default)
  create_file: access_mask = 0x6019f file_attributes = 0x20, share_access = 
0x0, create_disposition = 0x2 create_options = 0x44 oplock_request
= 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), fname = 
home/foo/open/test.cfg
[2011/09/27 17:41:41.128359,  3] smbd/vfs.c:881(check_reduced_name)
  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128377, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128386,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128394, 10] smbd/open.c:2941(create_file_unixpath)
  create_file_unixpath: access_mask = 0x6019f file_attributes = 0x20, 
share_access = 0x0, create_disposition = 0x2 create_options = 0x44 oplock
_request = 0x3 ea_list = 0x(nil), sd = 0x(nil), fname = home/foo/open/test.cfg
[2011/09/27 17:41:41.128406,  5] smbd/files.c:119(file_new)
  allocated file structure 14342, fnum = 18438 (4 used)
[2011/09/27 17:41:41.128416,  3] smbd/dosmode.c:166(unix_mode)
  unix_mode(home/foo/open/test.cfg) returning 0744
[2011/09/27 17:41:41.128424, 10] smbd/open.c:1556(open_file_ntcreate)
  open_file_ntcreate: fname=home/foo/open/test.cfg, dos_attrs=0x20 
access_mask=0x6019f share_access=0x0 create_disposition = 0x2 create_options
=0x44 unix mode=0744 oplock_requ

Re: [Samba] oplocks issue when trying to copy file

2011-09-29 Thread Philip Ong
Kernel tried on Centos 4.5 was 2.6.38.8

-Original Message-
From: Philip Ong 
Sent: Wednesday, September 28, 2011 3:44 PM
To: Philip Ong; 'samba@lists.samba.org'
Subject: RE: oplocks issue when trying to copy file 

I also tried this on Centos 4.5 and it has the same results so it is probably 
not distro related.

-Original Message-
From: Philip Ong 
Sent: Tuesday, September 27, 2011 10:41 PM
To: samba@lists.samba.org
Cc: Philip Ong
Subject: oplocks issue when trying to copy file 

I'm not sure if this a Kernel/samba or NFS issue. We run this on Centos 5.6 
using a kernel.org kernel.

Please find below the problem description

When trying to copy a file to a samba share which has NFS backend on 2.6.36.3 
or newer Linux kernel following message is displayed on windows client 

"An unexpected error is keeping you from copying the file. If you continue to 
receive this error, you can use the error code to search for help with this 
problem.
Error 0x80070021: The process cannot access the file because another process 
has locked a portion of the file"

I am able to delete a file within the same directory structure. I am also able 
to create a file or folder by right-clicking within Windows Explorer on XP. 
Below are the logs generated by samba in debug mode. The main line of interest 
was:

  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
33, file_id = 17:aa41ab:0. (Invalid argument)


Please note "test.cfg" was the file which we were trying to copy from windows

  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128330, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128339,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128348, 10] smbd/open.c:3414(create_file_default)
  create_file: access_mask = 0x6019f file_attributes = 0x20, share_access = 
0x0, create_disposition = 0x2 create_options = 0x44 oplock_request
= 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), fname = 
home/foo/open/test.cfg
[2011/09/27 17:41:41.128359,  3] smbd/vfs.c:881(check_reduced_name)
  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128377, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128386,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128394, 10] smbd/open.c:2941(create_file_unixpath)
  create_file_unixpath: access_mask = 0x6019f file_attributes = 0x20, 
share_access = 0x0, create_disposition = 0x2 create_options = 0x44 oplock
_request = 0x3 ea_list = 0x(nil), sd = 0x(nil), fname = home/foo/open/test.cfg
[2011/09/27 17:41:41.128406,  5] smbd/files.c:119(file_new)
  allocated file structure 14342, fnum = 18438 (4 used)
[2011/09/27 17:41:41.128416,  3] smbd/dosmode.c:166(unix_mode)
  unix_mode(home/foo/open/test.cfg) returning 0744
[2011/09/27 17:41:41.128424, 10] smbd/open.c:1556(open_file_ntcreate)
  open_file_ntcreate: fname=home/foo/open/test.cfg, dos_attrs=0x20 
access_mask=0x6019f share_access=0x0 create_disposition = 0x2 create_options
=0x44 unix mode=0744 oplock_request=3
[2011/09/27 17:41:41.128434,  3] smbd/vfs.c:881(check_reduced_name)
  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128462, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128471,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128480, 10] smbd/open.c:1738(open_file_ntcreate)
  open_file_ntcreate: fname=home/foo/open/test.cfg, after mapping 
access_mask=0x6019f
[2011/09/27 17:41:41.128489,  4] smbd/open.c:2000(open_file_ntcreate)
  calling open_file with flags=0x2 flags2=0xC0 mode=0744, access_mask = 
0x6019f, open_access_mask = 0x6019f
[2011/09/27 17:41:41.132844, 10] smbd/open.c:180(fd_open)
  fd_open: name home/foo/open/test.cfg, flags = 0302 mode = 0744, fd = 33.
[2011/09/27 17:41:41.132887, 10] smbd/notify_internal.c:890(notify_trigger)
  notify_trigger called action=0x1, filter=0x1, path=//home/foo/open/test.cfg
[2011/09/27 17:41:41.132897,  2] smbd/open.c:657(open_file)
  jneil opened file home/foo/open/test.cfg read=Yes write=Yes (numopen=4)
[2011/09/27 17:41:41.132909, 10] lib/dbwrap_tdb.c:100(db_tdb_fetch_locked)
  Locking key 1700AB41
[2011/09/27 17:41:41.132919, 10] lib/dbwrap_tdb.c:129(db_tdb_fetch_locked)
  Allocated locked data 0x0x782393a0
[2011/09/27 17:41:41.132938, 10] smbd/open.c:1057(delay_for_oplocks)
  delay_for_oplocks: oplock type 0x3 on file home/foo/open/test.cfg
[2011/09/27 17:41:41.132947, 10] smbd/open.c:1057(delay_for_oplocks)
  

Re: [Samba] oplocks issue when trying to copy file

2011-09-28 Thread Philip Ong
I also tried this on Centos 4.5 and it has the same results so it is probably 
not distro related.

-Original Message-
From: Philip Ong 
Sent: Tuesday, September 27, 2011 10:41 PM
To: samba@lists.samba.org
Cc: Philip Ong
Subject: oplocks issue when trying to copy file 

I'm not sure if this a Kernel/samba or NFS issue. We run this on Centos 5.6 
using a kernel.org kernel.

Please find below the problem description

When trying to copy a file to a samba share which has NFS backend on 2.6.36.3 
or newer Linux kernel following message is displayed on windows client 

"An unexpected error is keeping you from copying the file. If you continue to 
receive this error, you can use the error code to search for help with this 
problem.
Error 0x80070021: The process cannot access the file because another process 
has locked a portion of the file"

I am able to delete a file within the same directory structure. I am also able 
to create a file or folder by right-clicking within Windows Explorer on XP. 
Below are the logs generated by samba in debug mode. The main line of interest 
was:

  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, fd = 
33, file_id = 17:aa41ab:0. (Invalid argument)


Please note "test.cfg" was the file which we were trying to copy from windows

  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128330, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128339,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128348, 10] smbd/open.c:3414(create_file_default)
  create_file: access_mask = 0x6019f file_attributes = 0x20, share_access = 
0x0, create_disposition = 0x2 create_options = 0x44 oplock_request
= 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), fname = 
home/foo/open/test.cfg
[2011/09/27 17:41:41.128359,  3] smbd/vfs.c:881(check_reduced_name)
  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128377, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128386,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128394, 10] smbd/open.c:2941(create_file_unixpath)
  create_file_unixpath: access_mask = 0x6019f file_attributes = 0x20, 
share_access = 0x0, create_disposition = 0x2 create_options = 0x44 oplock
_request = 0x3 ea_list = 0x(nil), sd = 0x(nil), fname = home/foo/open/test.cfg
[2011/09/27 17:41:41.128406,  5] smbd/files.c:119(file_new)
  allocated file structure 14342, fnum = 18438 (4 used)
[2011/09/27 17:41:41.128416,  3] smbd/dosmode.c:166(unix_mode)
  unix_mode(home/foo/open/test.cfg) returning 0744
[2011/09/27 17:41:41.128424, 10] smbd/open.c:1556(open_file_ntcreate)
  open_file_ntcreate: fname=home/foo/open/test.cfg, dos_attrs=0x20 
access_mask=0x6019f share_access=0x0 create_disposition = 0x2 create_options
=0x44 unix mode=0744 oplock_request=3
[2011/09/27 17:41:41.128434,  3] smbd/vfs.c:881(check_reduced_name)
  check_reduced_name [home/foo/open/test.cfg] [/]
[2011/09/27 17:41:41.128462, 10] smbd/vfs.c:968(check_reduced_name)
  check_reduced_name realpath [home/foo/open/test.cfg] -> 
[/home/foo/open/test.cfg]
[2011/09/27 17:41:41.128471,  3] smbd/vfs.c:1038(check_reduced_name)
  check_reduced_name: home/foo/open/test.cfg reduced to /home/foo/open/test.cfg
[2011/09/27 17:41:41.128480, 10] smbd/open.c:1738(open_file_ntcreate)
  open_file_ntcreate: fname=home/foo/open/test.cfg, after mapping 
access_mask=0x6019f
[2011/09/27 17:41:41.128489,  4] smbd/open.c:2000(open_file_ntcreate)
  calling open_file with flags=0x2 flags2=0xC0 mode=0744, access_mask = 
0x6019f, open_access_mask = 0x6019f
[2011/09/27 17:41:41.132844, 10] smbd/open.c:180(fd_open)
  fd_open: name home/foo/open/test.cfg, flags = 0302 mode = 0744, fd = 33.
[2011/09/27 17:41:41.132887, 10] smbd/notify_internal.c:890(notify_trigger)
  notify_trigger called action=0x1, filter=0x1, path=//home/foo/open/test.cfg
[2011/09/27 17:41:41.132897,  2] smbd/open.c:657(open_file)
  jneil opened file home/foo/open/test.cfg read=Yes write=Yes (numopen=4)
[2011/09/27 17:41:41.132909, 10] lib/dbwrap_tdb.c:100(db_tdb_fetch_locked)
  Locking key 1700AB41
[2011/09/27 17:41:41.132919, 10] lib/dbwrap_tdb.c:129(db_tdb_fetch_locked)
  Allocated locked data 0x0x782393a0
[2011/09/27 17:41:41.132938, 10] smbd/open.c:1057(delay_for_oplocks)
  delay_for_oplocks: oplock type 0x3 on file home/foo/open/test.cfg
[2011/09/27 17:41:41.132947, 10] smbd/open.c:1057(delay_for_oplocks)
  delay_for_oplocks: oplock type 0x3 on file home/foo/open/test.cfg
[2011/09/27 17:41:41.267573,  3] 
smbd/oplock_linux.c:120(linux_set_kernel_oplock)
  linux_set_kernel_oplock: Refused oplock on file home/foo/open/test.cfg, f