Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#7 fcntl23 can't set a read lease on a r/w open file

System Calls
closed-rejected
Testcases (27)
5
2005-05-26
2005-05-18
Roman Kagan
No

fcntl23 attempts to set a read lease

fcntl(fd, F_SETLEASE,F_RDLCK)

on a file which it opens read/write

fd = open(fname,O_RDWR|O_CREAT,0777)

and naturally receives -EAGAIN. The attached file
fixes it to open the file readonly.

Discussion

  • Roman Kagan
    Roman Kagan
    2005-05-18

    Open file readonly to enable setting a read lease on it

     
    • assigned_to: nobody --> robbiew
     
    • status: open --> open-rejected
     
  • Logged In: YES
    user_id=236704

    This is working correctly. Here's a note regarding the bug
    you may be encountering:
    -------------------------------
    Subject:
    Re: Fw: [2.6.10-rc3:fs/locks.c] fcntl F_SETLEASE/[ F_WRLCK|
    F_RDLCK] inconsistencies
    From:
    Linus Torvalds <torvalds@osdl.org>
    Date:
    Tue, 7 Dec 2004 18:52:42 -0800 (PST)
    To:
    Andrew Morton <akpm@osdl.org>
    CC:
    andros@thnk.citi.umich.edu, Ricky Ng-Adam
    <rngadam@yahoo.com>, Matthew Wilcox
    <willy@debian.org>

    On Tue, 7 Dec 2004, Andrew Morton wrote:

    >> Thoughts?
    >>

    Well, The "0" can definitely not be just changed to a "1"
    for the
    i_writecount check, but maybe something like

    int maxwrites = (file->f_mode & FMODE_WRITE) ? 1 : 0;

    if (arg == F_RDLCK &&
    atomic_read(&inode->i_writecount) > maxwrites)
    ...

    might work.

    Who uses F_SETLEASE? Just the samba/NFSv4 servers? It really
    should be up
    to those, unless there are other real users..

    Linus

     
    • status: open-rejected --> closed-rejected