RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1461231 - [RFE] Support OFD locking constants, but disable them for 32-bit offsets (not following upstream) (glibc)
Summary: [RFE] Support OFD locking constants, but disable them for 32-bit offsets (not...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: DJ Delorie
QA Contact: Alexandra Petlanová Hájková
Tomas Capek
URL:
Whiteboard:
Depends On: 1444778
Blocks: 1378241 1515811 1565233
TreeView+ depends on / blocked
 
Reported: 2017-06-14 01:28 UTC by Ademar Reis
Modified: 2018-11-02 06:37 UTC (History)
19 users (show)

Fixed In Version: glibc-2.17-239.el7
Doc Type: Enhancement
Doc Text:
New OFD Locking constants for 64-bit-offset programs Open File Descriptor (OFD) locks are superior to per-process locks for some applications. With this update, 64-bit-offset programs (those that have `#define _FILE_OFFSET_BITS 64`) are able to use the `F_OFD_*` constants in system calls, although they still need to detect if the kernel supports those operations. Note that programs which use 32-bit file offsets do not have access to these constants, as the RHEL 7 ABI does not support translating them.
Clone Of: 1444778
Environment:
Last Closed: 2018-10-30 09:36:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3092 0 None None None 2018-10-30 09:38:20 UTC
Sourceware 20251 0 P2 RESOLVED 32bit programs pass garbage in struct flock for OFD locks 2021-01-27 09:58:31 UTC

Description Ademar Reis 2017-06-14 01:28:10 UTC
+++ This bug was initially created as a clone of Bug #1444778 +++

F_OFD_* locking API is superior to posix locks and flock(1), we need it in RHEL to support applications doing proper file locking.

The problem with posix locks are described in

https://lwn.net/Articles/586904/

The disadvantage with flock(1) is it doesn't reliably work in certain cases like NFS (where it is translated to posix locks).

As a concrete requirement, QEMU wants to use OFD locks to protect image files it opens, so that no concurrent writtings from different processes can happen, which would corrupt a qcow2 image, as an example.

--- Additional comment from Jeff Layton on 2017-04-24 18:48:27 BRT ---

It's certainly doable to add it, and I don't think it'd be problematic for kABI. 

Note that we'd also need to coordinate this with the companion glibc patches as well.

--- Additional comment from Eric Sandeen on 2017-04-24 18:55:13 BRT ---

I'm not sure that glibc can add new syscalls to a RHEL release w/o ABI problems - we ran into that back in the fallocate days ...

--- Additional comment from Jeff Layton on 2017-04-24 19:01:52 BRT ---

We don't need a new syscall here. It's just a matter of adding the F_OFD_* constants to the headers (and updating the docs if we care about that). If the kernel doesn't recognize the F_OFD_* commands, then it will just return -EINVAL.

QEMU or whatever will need to be able to detect that as well.

Comment 1 Carlos O'Donell 2017-06-15 04:49:33 UTC
We are currently in the practice of adding new constants to header files to enable kernel functionality, and this is just such a request, so we shouldn't have any real problem adding this to rhel-7.5.

The upstream commit is here:

commit 0961f7e1e300ef633b0c1ad95d0999fb5c169f4e
Author: Jeff Layton <jlayton>
Date:   Wed Jul 23 14:21:05 2014 -0400

    fcntl-linux.h: add new definitions and manual updates for open file description locks
    
    Open file description locks have been merged into the Linux kernel for
    v3.15.  Add the appropriate command-value definitions and an update to
    the manual that describes their usage.

Comment 8 Florian Weimer 2018-04-03 12:12:50 UTC
One concern is that the upstream API for this is still somewhat inconsistent (see swbz#20251).  On the other hand, what is currently upstream is probably better than no support at all.

Comment 9 Jeff Layton 2018-04-03 12:37:21 UTC
Interesting, I hadn't seen that swbz before. That's something that we should fix upstream. The original idea was to make these unavailable without large file offsets, IIRC.

I'm fine with making such programs fail to compile. Maybe the F_OFD_* constants should be inside a #ifdef __USE_LARGEFILE64 condition?

Comment 17 Alexandra Petlanová Hájková 2018-09-11 07:50:16 UTC
I verified the provided example ofdlocks.c doesn't compile for the version 
glibc-2.17-238.el7 because of error: ‘F_OFD_SETLKW’ undeclared and error: ‘F_OFD_SETLK’ undeclared and compiles (with -D_FILE_OFFSET_BITS=64) and executes for the version glibc-2.17-239.el7.
https://beaker.engineering.redhat.com/jobs/2757497
https://beaker.engineering.redhat.com/jobs/2758482

Comment 19 errata-xmlrpc 2018-10-30 09:36:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3092


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