Bug 200471 - fcntl(F_SETLEASE) is broken in 2.6.17
Summary: fcntl(F_SETLEASE) is broken in 2.6.17
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
(Show other bugs)
Version: 5
Hardware: All Linux
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Brian Brock
Keywords: Patch
Depends On:
TreeView+ depends on / blocked
Reported: 2006-07-27 21:41 UTC by Orion Poplawski
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version: 2.6.17-1.2187_FC5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-10-16 19:24:48 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test program (3.11 KB, text/plain)
2006-07-27 21:41 UTC, Orion Poplawski
no flags Details

Description Orion Poplawski 2006-07-27 21:41:30 UTC
Description of problem:

fctnl(F_SETSIG) no longer works in 2.6.17, does in 2.6.16.

The attached program illustrates.  Compile and run with strace.  In another
shell do "echo >> oplockstest.c".  On 2.6.16 we get:

fcntl64(3, F_SETSIG, 0x23)              = 0
fcntl64(3, 0x400 /* F_??? */, 0x1)      = 0
nanosleep({50, 0}, 0)                   = ? ERESTART_RESTARTBLOCK (To be restarted)
--- SIGRT_3 (Real-time signal 1) @ 0 (0) ---
+++ killed by SIGRT_3 +++

on 2.6.17 we get:

fcntl64(3, F_SETSIG, 0x23)              = 0
fcntl64(3, 0x400 /* F_??? */, 0x1)      = 0
nanosleep({50, 0}, 0)                   = ? ERESTART_RESTARTBLOCK (To be restarted)
--- SIGIO (I/O possible) @ 0 (0) ---
+++ killed by SIGIO +++

The signal is no longer changed from SIGIO to SIGRT_3.

This causes problems with samba and kernel oplocks.  See closed bug #200452 for
more info.

Comment 1 Orion Poplawski 2006-07-27 21:41:30 UTC
Created attachment 133200 [details]
Test program

Comment 2 Orion Poplawski 2006-07-31 15:12:24 UTC
From a reply on LKML from Chuck Ebbert:

I added some debug statements to your code:

=>      printf("before setlease: signal number = %d\n", fcntl(fd, F_GETSIG));
        ret = fcntl(fd, F_SETLEASE, leasetype);
        if (ret == -1 && errno == EACCES) {
                ret = fcntl(fd, F_SETLEASE, leasetype);
=>      printf("after setlease: signal number = %d\n", fcntl(fd, F_GETSIG));

And I get:

before setlease: signal number = 34
after setlease: signal number = 0

So the fcntl(F_SETLEASE) is resetting the signal number.  I don't think
it's supposed to do that.

That seems to be caused by:

| From: Trond Myklebust <Trond.Myklebust@netapp.com>
| Date: Mon, 20 Mar 2006 18:44:05 +0000 (-0500)
| Subject: VFS: Fix __posix_lock_file() copy of private lock area
| X-Git-Tag: v2.6.17-rc1
| X-Git-Url:
| VFS: Fix __posix_lock_file() copy of private lock area
| The struct file_lock->fl_u area must be copied using the fl_copy_lock()
| operation.

In this change:

|  */
| void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
| {
|+       locks_release_private(new);
|        new->fl_owner = fl->fl_owner;
|        new->fl_pid = fl->fl_pid;
|        new->fl_file = fl->fl_file;

Which ends up calling this:

static void lease_release_private_callback(struct file_lock *fl)
        if (!fl->fl_file)

=>      fl->fl_file->f_owner.signum = 0;

I'm not sure how to fix it, though (if that's really the problem, but I
think it is.)

Comment 3 Orion Poplawski 2006-08-08 14:58:37 UTC
Patch posted by Trond Myklebust:

Comment 4 Dave Jones 2006-10-16 19:23:49 UTC
A new kernel update has been released (Version: 2.6.18-1.2200.fc5)
based upon a new upstream kernel release.

Please retest against this new kernel, as a large number of patches
go into each upstream release, possibly including changes that
may address this problem.

This bug has been placed in NEEDINFO state.
Due to the large volume of inactive bugs in bugzilla, if this bug is
still in this state in two weeks time, it will be closed.

Should this bug still be relevant after this period, the reporter
can reopen the bug at any time. Any other users on the Cc: list
of this bug can request that the bug be reopened by adding a
comment to the bug.

In the last few updates, some users upgrading from FC4->FC5
have reported that installing a kernel update has left their
systems unbootable. If you have been affected by this problem
please check you only have one version of device-mapper & lvm2
installed.  See bug 207474 for further details.

If this bug is a problem preventing you from installing the
release this version is filed against, please see bug 169613.

If this bug has been fixed, but you are now experiencing a different
problem, please file a separate bug for the new problem.

Thank you.

Note You need to log in before you can comment on or make changes to this bug.