23 Oct, 2010

3 commits

  • * 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    vfs: make no_llseek the default
    vfs: don't use BKL in default_llseek
    llseek: automatically add .llseek fop
    libfs: use generic_file_llseek for simple_attr
    mac80211: disallow seeks in minstrel debug code
    lirc: make chardev nonseekable
    viotape: use noop_llseek
    raw: use explicit llseek file operations
    ibmasmfs: use generic_file_llseek
    spufs: use llseek in all file operations
    arm/omap: use generic_file_llseek in iommu_debug
    lkdtm: use generic_file_llseek in debugfs
    net/wireless: use generic_file_llseek in debugfs
    drm: use noop_llseek

    Linus Torvalds
     
  • * 'vfs' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: (30 commits)
    BKL: remove BKL from freevxfs
    BKL: remove BKL from qnx4
    autofs4: Only declare function when CONFIG_COMPAT is defined
    autofs: Only declare function when CONFIG_COMPAT is defined
    ncpfs: Lock socket in ncpfs while setting its callbacks
    fs/locks.c: prepare for BKL removal
    BKL: Remove BKL from ncpfs
    BKL: Remove BKL from OCFS2
    BKL: Remove BKL from squashfs
    BKL: Remove BKL from jffs2
    BKL: Remove BKL from ecryptfs
    BKL: Remove BKL from afs
    BKL: Remove BKL from USB gadgetfs
    BKL: Remove BKL from autofs4
    BKL: Remove BKL from isofs
    BKL: Remove BKL from fat
    BKL: Remove BKL from ext2 filesystem
    BKL: Remove BKL from do_new_mount()
    BKL: Remove BKL from cgroup
    BKL: Remove BKL from NTFS
    ...

    Linus Torvalds
     
  • * 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
    BKL: introduce CONFIG_BKL.
    dabusb: remove the BKL
    sunrpc: remove the big kernel lock
    init/main.c: remove BKL notations
    blktrace: remove the big kernel lock
    rtmutex-tester: make it build without BKL
    dvb-core: kill the big kernel lock
    dvb/bt8xx: kill the big kernel lock
    tlclk: remove big kernel lock
    fix rawctl compat ioctls breakage on amd64 and itanic
    uml: kill big kernel lock
    parisc: remove big kernel lock
    cris: autoconvert trivial BKL users
    alpha: kill big kernel lock
    isapnp: BKL removal
    s390/block: kill the big kernel lock
    hpet: kill BKL, add compat_ioctl

    Linus Torvalds
     

22 Oct, 2010

9 commits

  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (48 commits)
    ocfs2: Avoid to evaluate xattr block flags again.
    ocfs2/cluster: Release debugfs file elapsed_time_in_ms
    ocfs2: Add a mount option "coherency=*" to handle cluster coherency for O_DIRECT writes.
    Initialize max_slots early
    When I tried to compile I got the following warning: fs/ocfs2/slot_map.c: In function ‘ocfs2_init_slot_info’: fs/ocfs2/slot_map.c:360: warning: ‘bytes’ may be used uninitialized in this function fs/ocfs2/slot_map.c:360: note: ‘bytes’ was declared here Compiler: gcc version 4.4.3 (GCC) on Mandriva I'm not sure why this warning occurs, I think compiler don't know that variable "bytes" is initialized when it is sent by reference to ocfs2_slot_map_physical_size and it throws that ugly warning. However, a simple initialization of "bytes" variable with 0 will fix it.
    ocfs2: validate bg_free_bits_count after update
    ocfs2/cluster: Bump up dlm protocol to version 1.1
    ocfs2/cluster: Show per region heartbeat elapsed time
    ocfs2/cluster: Add mlogs for heartbeat up/down events
    ocfs2/cluster: Create debugfs dir/files for each region
    ocfs2/cluster: Create debugfs files for live, quorum and failed region bitmaps
    ocfs2/cluster: Maintain bitmap of failed regions
    ocfs2/cluster: Maintain bitmap of quorum regions
    ocfs2/cluster: Track bitmap of live heartbeat regions
    ocfs2/cluster: Track number of global heartbeat regions
    ocfs2/cluster: Maintain live node bitmap per heartbeat region
    ocfs2/cluster: Reorganize o2hb debugfs init
    ocfs2/cluster: Check slots for unconfigured live nodes
    ocfs2/cluster: Print messages when adding/removing nodes
    ocfs2/cluster: Print messages when adding/removing heartbeat regions
    ...

    Linus Torvalds
     
  • * 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (278 commits)
    arm: remove machine_desc.io_pg_offst and .phys_io
    arm: use addruart macro to establish debug mappings
    arm: return both physical and virtual addresses from addruart
    arm/debug: consolidate addruart macros for CONFIG_DEBUG_ICEDCC
    ARM: make struct machine_desc definition coherent with its comment
    eukrea_mbimxsd-baseboard: Pass the correct GPIO to gpio_free
    cpuimx27: fix compile when ULPI is selected
    mach-pcm037_eet: fix compile errors
    Fixing ethernet driver compilation error for i.MX31 ADS board
    cpuimx51: update board support
    mx5: add cpuimx51sd module and its baseboard
    iomux-mx51: fix GPIO_1_xx 's IOMUX configuration
    imx-esdhc: update devices registration
    mx51: add resources for SD/MMC on i.MX51
    iomux-mx51: fix SD1 and SD2's iomux configuration
    clock-mx51: rename CLOCK1 to CLOCK_CCGR for better readability
    clock-mx51: factorize clk_set_parent and clk_get_rate
    eukrea_mbimxsd: add support for DVI displays
    cpuimx25 & cpuimx35: fix OTG port registration in host mode
    i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472
    ...

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: (26 commits)
    PM / Wakeup: Show wakeup sources statistics in debugfs
    PM: Introduce library for device-specific OPPs (v7)
    PM: Add sysfs attr for rechecking dev hash from PM trace
    PM: Lock PM device list mutex in show_dev_hash()
    PM / Runtime: Remove idle notification after failing suspend
    PM / Hibernate: Modify signature used to mark swap
    PM / Runtime: Reduce code duplication in core helper functions
    PM: Allow wakeup events to abort freezing of tasks
    PM: runtime: add missed pm_request_autosuspend
    PM / Hibernate: Make some boot messages look less scary
    PM / Runtime: Implement autosuspend support
    PM / Runtime: Add no_callbacks flag
    PM / Runtime: Combine runtime PM entry points
    PM / Runtime: Merge synchronous and async runtime routines
    PM / Runtime: Replace boolean arguments with bitflags
    PM / Runtime: Move code in drivers/base/power/runtime.c
    sysfs: Add sysfs_merge_group() and sysfs_unmerge_group()
    PM: Fix potential issue with failing asynchronous suspend
    PM / Wakeup: Introduce wakeup source objects and event statistics (v3)
    PM: Fix signed/unsigned warning in dpm_show_time()
    ...

    Linus Torvalds
     
  • …el/git/tip/linux-2.6-tip

    * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    lockdep: Check the depth of subclass
    lockdep: Add improved subclass caching
    affs: Use sema_init instead of init_MUTEX
    hfs: Convert tree_lock to mutex
    arm: Bcmring: semaphore cleanup
    printk: Make console_sem a semaphore not a pseudo mutex
    drivers/macintosh/adb: Do not claim that the semaphore is a mutex
    parport: Semaphore cleanup
    irda: Semaphore cleanup
    net: Wan/cosa.c: Convert "mutex" to semaphore
    net: Ppp_async: semaphore cleanup
    hamradio: Mkiss: semaphore cleanup
    hamradio: 6pack: semaphore cleanup
    net: 3c527: semaphore cleanup
    input: Serio/hp_sdc: semaphore cleanup
    input: Serio/hil_mlc: semaphore cleanup
    input: Misc/hp_sdc_rtc: semaphore cleanup
    lockup_detector: Make callback function static
    lockup detector: Fix grammar by adding a missing "to" in the comments
    lockdep: Remove __debug_show_held_locks

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw: (22 commits)
    GFS2: fixed typo
    GFS2: Fix type mapping for demote_rq interface
    GFS2 fatal: filesystem consistency error on rename
    GFS2: Improve journal allocation via sysfs
    GFS2: Add "norecovery" mount option as a synonym for "spectator"
    GFS2: Fix spectator umount issue
    GFS2: Fix compiler warning from previous patch
    GFS2: reserve more blocks for transactions
    GFS2: Fix journal check for spectator mounts
    GFS2: Remove upgrade mount option
    GFS2: Remove localcaching mount option
    GFS2: Remove ignore_local_fs mount argument
    GFS2: Make . and .. qstrs constant
    GFS2: Use new workqueue scheme
    GFS2: Update handling of DLM return codes to match reality
    GFS2: Don't enforce min hold time when two demotes occur in rapid succession
    GFS2: Fix whitespace in previous patch
    GFS2: fallocate support
    GFS2: Add a bug trap in allocation code
    GFS2: No longer experimental
    ...

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: (22 commits)
    ceph: do not carry i_lock for readdir from dcache
    fs/ceph/xattr.c: Use kmemdup
    rbd: passing wrong variable to bvec_kunmap_irq()
    rbd: null vs ERR_PTR
    ceph: fix num_pages_free accounting in pagelist
    ceph: add CEPH_MDS_OP_SETDIRLAYOUT and associated ioctl.
    ceph: don't crash when passed bad mount options
    ceph: fix debugfs warnings
    block: rbd: removing unnecessary test
    block: rbd: fixed may leaks
    ceph: switch from BKL to lock_flocks()
    ceph: preallocate flock state without locks held
    ceph: add pagelist_reserve, pagelist_truncate, pagelist_set_cursor
    ceph: use mapping->nrpages to determine if mapping is empty
    ceph: only invalidate on check_caps if we actually have pages
    ceph: do not hide .snap in root directory
    rbd: introduce rados block device (rbd), based on libceph
    ceph: factor out libceph from Ceph file system
    ceph-rbd: osdc support for osd call and rollback operations
    ceph: messenger and osdc changes for rbd
    ...

    Linus Torvalds
     
  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus: (29 commits)
    hfsplus: fix getxattr return value
    hfsplus: remove the unused hfsplus_kmap/hfsplus_kunmap helpers
    hfsplus: create correct initial catalog entries for device files
    hfsplus: remove superflous rootflags field in hfsplus_inode_info
    hfsplus: fix link corruption
    hfsplus: validate btree flags
    hfsplus: handle more on-disk corruptions without oopsing
    hfsplus: hfs_bnode_find() can fail, resulting in hfs_bnode_split() breakage
    hfsplus: fix oops on mount with corrupted btree extent records
    hfsplus: fix rename over directories
    hfsplus: convert tree_lock to mutex
    hfsplus: add missing extent locking in hfsplus_write_inode
    hfsplus: protect readdir against removals from open_dir_list
    hfsplus: use atomic bitops for the superblock flags
    hfsplus: add per-superblock lock for volume header updates
    hfsplus: remove the rsrc_inodes list
    hfsplus: do not cache and write next_alloc
    hfsplus: fix error handling in hfsplus_symlink
    hfsplus: merge mknod/mkdir/creat
    hfsplus: clean up hfsplus_write_inode
    ...

    Linus Torvalds
     
  • All uses of the BKL in freevxfs were the result of a pushdown into
    code that doesn't really need it. As Christoph points out, this
    is a read-only file system, which eliminates most of the races in
    readdir/lookup.

    Signed-off-by: Arnd Bergmann
    Cc: Christoph Hellwig

    Arnd Bergmann
     
  • All uses of the BKL in qnx4 were the result of a pushdown into
    code that doesn't really need it. As Christoph points out, this
    is a read-only file system, which eliminates most of the races in
    readdir/lookup.

    Signed-off-by: Arnd Bergmann
    Acked-by: Anders Larsen
    Cc: Christoph Hellwig

    Arnd Bergmann
     

21 Oct, 2010

15 commits

  • With all the patches we have queued in the BKL removal tree, only a
    few dozen modules are left that actually rely on the BKL, and even
    there are lots of low-hanging fruit. We need to decide what to do
    about them, this patch illustrates one of the options:

    Every user of the BKL is marked as 'depends on BKL' in Kconfig,
    and the CONFIG_BKL becomes a user-visible option. If it gets
    disabled, no BKL using module can be built any more and the BKL
    code itself is compiled out.

    The one exception is file locking, which is practically always
    enabled and does a 'select BKL' instead. This effectively forces
    CONFIG_BKL to be enabled until we have solved the fs/lockd
    mess and can apply the patch that removes the BKL from fs/locks.c.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • We were taking dcache_lock inside of i_lock, which introduces a dependency
    not found elsewhere in the kernel, complicationg the vfs locking
    scalability work. Since we don't actually need it here anyway, remove
    it.

    We only need i_lock to test for the I_COMPLETE flag, so be careful to do
    so without dcache_lock held.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • Convert a sequence of kmalloc and memcpy to use kmemdup.

    The semantic patch that performs this transformation is:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression a,flag,len;
    expression arg,e1,e2;
    statement S;
    @@

    a =
    - \(kmalloc\|kzalloc\)(len,flag)
    + kmemdup(arg,len,flag)

    - memcpy(a,arg,len+1);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Sage Weil

    Julia Lawall
     
  • Signed-off-by: Sage Weil

    Greg Farnum
     
  • Include "super.h" outside of CONFIG_DEBUG_FS to eliminate a compiler warning:

    fs/ceph/debugfs.c:266: warning: 'struct ceph_fs_client' declared inside parameter list
    fs/ceph/debugfs.c:266: warning: its scope is only this definition or declaration, which is probably not what you want
    fs/ceph/debugfs.c:271: warning: 'struct ceph_fs_client' declared inside parameter list

    Signed-off-by: Randy Dunlap
    Signed-off-by: Yehuda Sadeh

    Randy Dunlap
     
  • Switch from using the BKL explicitly to the new lock_flocks() interface.
    Eventually this will turn into a spinlock.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • When the lock_kernel() turns into lock_flocks() and a spinlock, we won't
    be able to do allocations with the lock held. Preallocate space without
    the lock, and retry if the lock state changes out from underneath us.

    Signed-off-by: Greg Farnum
    Signed-off-by: Sage Weil

    Greg Farnum
     
  • This is simpler and faster.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • The i_rdcache_gen value only implies we MAY have cached pages; actually
    check the mapping to see if it's worth bothering with an invalidate.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • Snaps in the root directory are now supported by the MDS, and harmless on
    older versions.

    Signed-off-by: Sage Weil

    Sage Weil
     
  • This factors out protocol and low-level storage parts of ceph into a
    separate libceph module living in net/ceph and include/linux/ceph. This
    is mostly a matter of moving files around. However, a few key pieces
    of the interface change as well:

    - ceph_client becomes ceph_fs_client and ceph_client, where the latter
    captures the mon and osd clients, and the fs_client gets the mds client
    and file system specific pieces.
    - Mount option parsing and debugfs setup is correspondingly broken into
    two pieces.
    - The mon client gets a generic handler callback for otherwise unknown
    messages (mds map, in this case).
    - The basic supported/required feature bits can be expanded (and are by
    ceph_fs_client).

    No functional change, aside from some subtle error handling cases that got
    cleaned up in the refactoring process.

    Signed-off-by: Sage Weil

    Yehuda Sadeh
     
  • This will be used for rbd snapshots administration.

    Signed-off-by: Yehuda Sadeh

    Yehuda Sadeh
     
  • Allow the messenger to send/receive data in a bio. This is added
    so that we wouldn't need to copy the data into pages or some other buffer
    when doing IO for an rbd block device.

    We can now have trailing variable sized data for osd
    ops. Also osd ops encoding is more modular.

    Signed-off-by: Yehuda Sadeh
    Signed-off-by: Sage Weil

    Yehuda Sadeh
     
  • The osd requests creation are being decoupled from the
    vino parameter, allowing clients using the osd to use
    other arbitrary object names that are not necessarily
    vino based. Also, calc_raw_layout now takes a snap id.

    Signed-off-by: Yehuda Sadeh
    Signed-off-by: Sage Weil

    Yehuda Sadeh
     
  • Implement a pool lookup by name. This will be used by rbd.

    Signed-off-by: Yehuda Sadeh
    Signed-off-by: Sage Weil

    Yehuda Sadeh
     

20 Oct, 2010

1 commit


19 Oct, 2010

2 commits

  • RAW_SETBIND and RAW_GETBIND 32bit versions are fscked in interesting ways.

    1) fs/compat_ioctl.c has COMPATIBLE_IOCTL(RAW_SETBIND) followed by
    HANDLE_IOCTL(RAW_SETBIND, raw_ioctl). The latter is ignored.

    2) on amd64 (and itanic) the damn thing is broken - we have int + u64 + u64
    and layouts on i386 and amd64 are _not_ the same. raw_ioctl() would
    work there, but it's never called due to (1). As it is, i386 /sbin/raw
    definitely doesn't work on amd64 boxen.

    3) switching to raw_ioctl() as is would *not* work on e.g. sparc64 and ppc64,
    which would be rather sad, seeing that normal userland there is 32bit.
    The thing is, slapping __packed on the struct in question does not DTRT -
    it eliminates *all* padding. The real solution is to use compat_u64.

    4) of course, all that stuff has no business being outside of raw.c in the
    first place - there should be ->compat_ioctl() for /dev/rawctl instead of
    messing with compat_ioctl.c.

    [akpm@linux-foundation.org: coding-style fixes]
    [arnd@arndb.de: port to 2.6.36]
    Signed-off-by: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Arnd Bergmann

    Al Viro
     
  • Merge reason: Update to almost-final-.36

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

18 Oct, 2010

1 commit


17 Oct, 2010

1 commit


16 Oct, 2010

3 commits


15 Oct, 2010

5 commits

  • All file operations now have an explicit .llseek
    operation pointer, so we can change the default
    action for future code.

    This makes changes the default from default_llseek
    to no_llseek, which always returns -ESPIPE if
    a user tries to seek on a file without a .llseek
    operation.

    The name of the default_llseek function remains
    unchanged, if anyone thinks we should change it,
    please speak up.

    Signed-off-by: Arnd Bergmann
    Cc: Christoph Hellwig
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org

    Arnd Bergmann
     
  • There are currently 191 users of default_llseek.
    Nine of these are in device drivers that use the
    big kernel lock. None of these ever touch
    file->f_pos outside of llseek or file_pos_write.

    Consequently, we never rely on the BKL
    in the default_llseek function and can
    replace that with i_mutex, which is also
    used in generic_file_llseek.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     
  • We need to support -EOPNOTSUPP for attributes that are not supported to
    match other filesystems and allow userspace to detect if Posix ACLs
    are supported or not. setxattr already gets this right.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • If you build aout support as a module, you'll want these exported.

    Reported-by: Tetsuo Handa
    Signed-off-by: Linus Torvalds

    Linus Torvalds