13 Dec, 2011

2 commits

  • Fix race between lseek(fd, 0, SEEK_CUR) and read/write. This was fixed in
    generic code by commit 5b6f1eb97d (vfs: lseek(fd, 0, SEEK_CUR) race condition).

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • The test in fuse_file_llseek() "not SEEK_CUR or not SEEK_SET" always evaluates
    to true.

    This was introduced in 3.1 by commit 06222e49 (fs: handle SEEK_HOLE/SEEK_DATA
    properly in all fs's that define their own llseek) and changed the behavior of
    SEEK_CUR and SEEK_SET to always retrieve the file attributes. This is a
    performance regression.

    Fix the test so that it makes sense.

    Signed-off-by: Miklos Szeredi
    CC: stable@vger.kernel.org
    CC: Josef Bacik
    CC: Al Viro

    Roel Kluin
     

25 Aug, 2011

1 commit


08 Aug, 2011

3 commits

  • As fuse does not use the page cache library functions when userspace
    writes to a file, it did not benefit from 'c8236db mm: mark page
    accessed before we write_end()' that made sure pages are properly
    marked accessed when written to.

    Signed-off-by: Johannes Weiner
    Signed-off-by: Miklos Szeredi

    Johannes Weiner
     
  • Ever since 'ea9b990 fuse: implement perform_write', the .write_begin
    and .write_end aops have been dead code.

    Their task - acquiring a page from the page cache, sending out a write
    request and releasing the page again - is now done batch-wise to
    maximize the number of pages send per userspace request.

    Signed-off-by: Johannes Weiner
    Signed-off-by: Miklos Szeredi

    Johannes Weiner
     
  • Commit a9ff4f87 "fuse: support BSD locking semantics" overlooked a
    number of issues with supporing flock locks over existing POSIX
    locking infrastructure:

    - it's not backward compatible, passing flock(2) calls to userspace
    unconditionally (if userspace sets FUSE_POSIX_LOCKS)

    - it doesn't cater for the fact that flock locks are automatically
    unlocked on file release

    - it doesn't take into account the fact that flock exclusive locks
    (write locks) don't need an fd opened for write.

    The last one invalidates the original premise of the patch that flock
    locks can be emulated with POSIX locks.

    This patch fixes the first two issues. The last one needs to be fixed
    in userspace if the filesystem assumed that a write lock will happen
    only on a file operned for write (as in the case of the current fuse
    library).

    Reported-by: Sebastian Pipping
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

26 Jul, 2011

1 commit

  • * 'for-3.1' of git://linux-nfs.org/~bfields/linux:
    nfsd: don't break lease on CLAIM_DELEGATE_CUR
    locks: rename lock-manager ops
    nfsd4: update nfsv4.1 implementation notes
    nfsd: turn on reply cache for NFSv4
    nfsd4: call nfsd4_release_compoundargs from pc_release
    nfsd41: Deny new lock before RECLAIM_COMPLETE done
    fs: locks: remove init_once
    nfsd41: check the size of request
    nfsd41: error out when client sets maxreq_sz or maxresp_sz too small
    nfsd4: fix file leak on open_downgrade
    nfsd4: remember to put RW access on stateid destruction
    NFSD: Added TEST_STATEID operation
    NFSD: added FREE_STATEID operation
    svcrpc: fix list-corrupting race on nfsd shutdown
    rpc: allow autoloading of gss mechanisms
    svcauth_unix.c: quiet sparse noise
    svcsock.c: include sunrpc.h to quiet sparse noise
    nfsd: Remove deprecated nfsctl system call and related code.
    NFSD: allow OP_DESTROY_CLIENTID to be only op in COMPOUND

    Fix up trivial conflicts in Documentation/feature-removal-schedule.txt

    Linus Torvalds
     

21 Jul, 2011

3 commits

  • Btrfs needs to be able to control how filemap_write_and_wait_range() is called
    in fsync to make it less of a painful operation, so push down taking i_mutex and
    the calling of filemap_write_and_wait() down into the ->fsync() handlers. Some
    file systems can drop taking the i_mutex altogether it seems, like ext3 and
    ocfs2. For correctness sake I just pushed everything down in all cases to make
    sure that we keep the current behavior the same for everybody, and then each
    individual fs maintainer can make up their mind about what to do from there.
    Thanks,

    Acked-by: Jan Kara
    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     
  • This converts everybody to handle SEEK_HOLE/SEEK_DATA properly. In some cases
    we just return -EINVAL, in others we do the normal generic thing, and in others
    we're simply making sure that the properly due-dilligence is done. For example
    in NFS/CIFS we need to make sure the file size is update properly for the
    SEEK_HOLE and SEEK_DATA case, but since it calls the generic llseek stuff itself
    that is all we have to do. Thanks,

    Signed-off-by: Josef Bacik
    Signed-off-by: Al Viro

    Josef Bacik
     
  • Both the filesystem and the lock manager can associate operations with a
    lock. Confusingly, one of them (fl_release_private) actually has the
    same name in both operation structures.

    It would save some confusion to give the lock-manager ops different
    names.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

31 Mar, 2011

1 commit


21 Mar, 2011

1 commit


25 Feb, 2011

1 commit

  • Single threaded NTFS-3G could get stuck if a delayed RELEASE reply
    triggered a DESTROY request via path_put().

    Fix this by

    a) making RELEASE requests synchronous, whenever possible, on fuseblk
    filesystems

    b) if not possible (triggered by an asynchronous read/write) then do
    the path_put() in a separate thread with schedule_work().

    Reported-by: Oliver Neukum
    Cc: stable@kernel.org
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

08 Dec, 2010

2 commits

  • In kernel ABI version 7.16 and later FUSE_IOCTL_RETRY reply from a
    unrestricted IOCTL request shall return with an array of 'struct
    fuse_ioctl_iovec' instead of 'struct iovec'. This fixes the ABI
    ambiguity of 32bit vs. 64bit.

    Reported-by: "ccmail111"
    Signed-off-by: Miklos Szeredi
    CC: Tejun Heo

    Miklos Szeredi
     
  • Get rid of unnecessary page_address()-es.

    Signed-off-by: Miklos Szeredi
    CC: Tejun Heo

    Miklos Szeredi
     

30 Nov, 2010

2 commits

  • Verify that the total length of the iovec returned in FUSE_IOCTL_RETRY
    doesn't overflow iov_length().

    Signed-off-by: Miklos Szeredi
    CC: Tejun Heo
    CC: [2.6.31+]

    Miklos Szeredi
     
  • If a 32bit CUSE server is run on 64bit this results in EIO being
    returned to the caller.

    The reason is that FUSE_IOCTL_RETRY reply was defined to use 'struct
    iovec', which is different on 32bit and 64bit archs.

    Work around this by looking at the size of the reply to determine
    which struct was used. This is only needed if CONFIG_COMPAT is
    defined.

    A more permanent fix for the interface will be to use the same struct
    on both 32bit and 64bit.

    Reported-by: "ccmail111"
    Signed-off-by: Miklos Szeredi
    CC: Tejun Heo
    CC: [2.6.31+]

    Miklos Szeredi
     

25 Nov, 2010

1 commit

  • The attribute cache for a file was not being cleared when a file is opened
    with O_TRUNC.

    If the filesystem's open operation truncates the file ("atomic_o_trunc"
    feature flag is set) then the kernel should invalidate the cached st_mtime
    and st_ctime attributes.

    Also i_size should be explicitly be set to zero as it is used sometimes
    without refreshing the cache.

    Signed-off-by: Ken Sumrall
    Cc: Anfei
    Cc: "Anand V. Avati"
    Signed-off-by: Miklos Szeredi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ken Sumrall
     

07 Sep, 2010

1 commit


12 Jul, 2010

1 commit

  • Userspace filesystem can request data to be stored in the inode's
    mapping. This request is synchronous and has no reply. If the write
    to the fuse device returns an error then the store request was not
    fully completed (but may have updated some pages).

    If the stored data overflows the current file size, then the size is
    extended, similarly to a write(2) on the filesystem.

    Pages which have been completely stored are marked uptodate.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

31 May, 2010

1 commit


28 May, 2010

1 commit


25 May, 2010

4 commits

  • When splicing buffers to the fuse device with SPLICE_F_MOVE, try to
    move pages from the pipe buffer into the page cache. This allows
    populating the fuse filesystem's cache without ever touching the page
    contents, i.e. zero copy read capability.

    The following steps are performed when trying to move a page into the
    page cache:

    - buf->ops->confirm() to make sure the new page is uptodate
    - buf->ops->steal() to try to remove the new page from it's previous place
    - remove_from_page_cache() on the old page
    - add_to_page_cache_locked() on the new page

    If any of the above steps fail (non fatally) then the code falls back
    to copying the page. In particular ->steal() will fail if there are
    external references (other than the page cache and the pipe buffer) to
    the page.

    Also since the remove_from_page_cache() + add_to_page_cache_locked()
    are non-atomic it is possible that the page cache is repopulated in
    between the two and add_to_page_cache_locked() will fail. This could
    be fixed by creating a new atomic replace_page_cache_page() function.

    fuse_readpages_end() needed to be reworked so it works even if
    page->mapping is NULL for some or all pages which can happen if the
    add_to_page_cache_locked() failed.

    A number of sanity checks were added to make sure the stolen pages
    don't have weird flags set, etc... These could be moved into generic
    splice/steal code.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Acquire a page ref on pages in ->readpages() and release them when the
    read has finished. Not acquiring a reference didn't seem to cause any
    trouble since the page is locked and will not be kicked out of the
    page cache during the read.

    However the following patches will want to remove the page from the
    cache so a separate ref is needed. Making the reference in req->pages
    explicit also makes the code easier to understand.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Replace uses of get_user_pages() with get_user_pages_fast(). It looks
    nicer and should be faster in most cases.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • "map" isn't needed any more after: 0bd87182d3ab18 "fuse: fix kunmap in
    fuse_ioctl_copy_user"

    Signed-off-by: Dan Carpenter
    Signed-off-by: Miklos Szeredi

    Dan Carpenter
     

03 Feb, 2010

1 commit

  • The cache alias problem will happen if the changes of user shared mapping
    is not flushed before copying, then user and kernel mapping may be mapped
    into two different cache line, it is impossible to guarantee the coherence
    after iov_iter_copy_from_user_atomic. So the right steps should be:

    flush_dcache_page(page);
    kmap_atomic(page);
    write to page;
    kunmap_atomic(page);
    flush_dcache_page(page);

    More precisely, we might create two new APIs flush_dcache_user_page and
    flush_dcache_kern_page to replace the two flush_dcache_page accordingly.

    Here is a snippet tested on omap2430 with VIPT cache, and I think it is
    not ARM-specific:

    int val = 0x11111111;
    fd = open("abc", O_RDWR);
    addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    *(addr+0) = 0x44444444;
    tmp = *(addr+0);
    *(addr+1) = 0x77777777;
    write(fd, &val, sizeof(int));
    close(fd);

    The results are not always 0x11111111 0x77777777 at the beginning as expected. Sometimes we see 0x44444444 0x77777777.

    Signed-off-by: Anfei
    Cc: Russell King
    Cc: Miklos Szeredi
    Cc: Nick Piggin
    Cc:
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    anfei zhou
     

04 Nov, 2009

2 commits


28 Sep, 2009

1 commit


01 Jul, 2009

1 commit


28 Apr, 2009

9 commits