1. 05 Nov, 2013 2 commits
    • Maxim Patlasov's avatar
      fuse: writepages: crop secondary requests · 6eaf4782
      Maxim Patlasov authored
      If writeback happens while fuse is in FUSE_NOWRITE condition, the request
      will be queued but not processed immediately (see fuse_flush_writepages()).
      Until FUSE_NOWRITE becomes relaxed, more writebacks can happen.  They will
      be queued as "secondary" requests to that first ("primary") request.
      
      Existing implementation crops only primary request.  This is not correct
      because a subsequent extending write(2) may increase i_size and then
      secondary requests won't be cropped properly.  The result would be stale
      data written to the server to a file offset where zeros must be.
      
      Similar problem may happen if secondary requests are attached to an
      in-flight request that was already cropped.
      
      The patch solves the issue by cropping all secondary requests in
      fuse_writepage_end().  Thanks to Miklos for idea.
      Signed-off-by: default avatarMaxim Patlasov <MPatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      6eaf4782
    • Maxim Patlasov's avatar
      fuse: writepages: roll back changes if request not found · f6011081
      Maxim Patlasov authored
      fuse_writepage_in_flight() returns false if it fails to find request with
      given index in fi->writepages.  Then the caller proceeds with populating
      data->orig_pages[] and incrementing req->num_pages.  Hence,
      fuse_writepage_in_flight() must revert changes it made in request before
      returning false.
      Signed-off-by: default avatarMaxim Patlasov <MPatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      f6011081
  2. 01 Oct, 2013 13 commits
    • Tom Gundersen's avatar
      cuse: add fix minor number to /dev/cuse · cb2ffb26
      Tom Gundersen authored
      This allows udev (or more recently systemd-tmpfiles) to create /dev/cuse on
      boot, in the same way as /dev/fuse is currently created, and the corresponding
      module to be loaded on first access.
      
      The corresponding functionalty was introduced for fuse in commit 578454ff.
      Signed-off-by: default avatarTom Gundersen <teg@jklm.no>
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      cb2ffb26
    • Miklos Szeredi's avatar
      fuse: writepage: skip already in flight · ff17be08
      Miklos Szeredi authored
      If ->writepage() tries to write back a page whose copy is still in flight,
      then just skip by calling redirty_page_for_writepage().
      
      This is OK, since now ->writepage() should never be called for data
      integrity sync.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      ff17be08
    • Miklos Szeredi's avatar
      fuse: writepages: handle same page rewrites · 8b284dc4
      Miklos Szeredi authored
      As Maxim Patlasov pointed out, it's possible to get a dirty page while it's
      copy is still under writeback, despite fuse_page_mkwrite() doing its thing
      (direct IO).
      
      This could result in two concurrent write request for the same offset, with
      data corruption if they get mixed up.
      
      To prevent this, fuse needs to check and delay such writes.  This
      implementation does this by:
      
       1. check if page is still under writeout, if so create a new, single page
          secondary request for it
      
       2. chain this secondary request onto the in-flight request
      
       2/a. if a seconday request for the same offset was already chained to the
          in-flight request, then just copy the contents of the page and discard
          the new secondary request.  This makes sure that for each page will
          have at most two requests associated with it
      
       3. when the in-flight request finished, send off all secondary requests
          chained onto it
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      8b284dc4
    • Miklos Szeredi's avatar
      fuse: writepages: fix aggregation · 1e112a48
      Miklos Szeredi authored
      Checking against tmp-page indexes is not very useful, and results in one
      (or rarely two) page requests.  Which is not much of an improvement...
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      1e112a48
    • Maxim Patlasov's avatar
      fuse: fix race in fuse_writepages() · 2d033eaa
      Maxim Patlasov authored
      The patch fixes a race between ftruncate(2), mmap-ed write and write(2):
      
      1) An user makes a page dirty via mmap-ed write.
      2) The user performs shrinking truncate(2) intended to purge the page.
      3) Before fuse_do_setattr calls truncate_pagecache, the page goes to
         writeback. fuse_writepages_fill attaches a new page to FUSE_WRITE request,
         then releases the original page by end_page_writeback and unlock it.
      4) fuse_do_setattr completes and successfully returns. Since now, i_mutex
         is free.
      5) Ordinary write(2) extends i_size back to cover the page. Note that
         fuse_send_write_pages do wait for fuse writeback, but for another
         page->index.
      6) fuse_writepages_fill attaches more pages to the request (if any), then
         fuse_writepages_send is eventually called. It is supposed to crop
         inarg->size of the request, but it doesn't because i_size has already been
         extended back.
      
      Moving end_page_writeback behind fuse_writepages_send guarantees that
      __fuse_release_nowrite (called from fuse_do_setattr) will crop inarg->size
      of the request before write(2) gets the chance to extend i_size.
      Signed-off-by: default avatarMaxim Patlasov <mpatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      2d033eaa
    • Pavel Emelyanov's avatar
      fuse: Implement writepages callback · 26d614df
      Pavel Emelyanov authored
      The .writepages one is required to make each writeback request carry more than
      one page on it. The patch enables optimized behaviour unconditionally,
      i.e. mmap-ed writes will benefit from the patch even if fc->writeback_cache=0.
      
      [SzM: simplify, add comments]
      Signed-off-by: default avatarMaxim Patlasov <MPatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      26d614df
    • Miklos Szeredi's avatar
      fuse: don't BUG on no write file · 72523425
      Miklos Szeredi authored
      Don't bug if there's no writable files found for page writeback.  If ever
      this is triggered, a WARN_ON helps debugging it much better then a BUG_ON.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      72523425
    • Miklos Szeredi's avatar
      fuse: lock page in mkwrite · cca24370
      Miklos Szeredi authored
      Lock the page in fuse_page_mkwrite() to protect against a race with
      fuse_writepage() where the page is redirtied before the actual writeback
      begins.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      cca24370
    • Pavel Emelyanov's avatar
      fuse: Prepare to handle multiple pages in writeback · 385b1268
      Pavel Emelyanov authored
      The .writepages callback will issue writeback requests with more than one
      page aboard. Make existing end/check code be aware of this.
      Signed-off-by: default avatarMaxim Patlasov <MPatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      385b1268
    • Pavel Emelyanov's avatar
      fuse: Getting file for writeback helper · adcadfa8
      Pavel Emelyanov authored
      There will be a .writepageS callback implementation which will need to
      get a fuse_file out of a fuse_inode, thus make a helper for this.
      Signed-off-by: default avatarMaxim Patlasov <MPatlasov@parallels.com>
      Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      adcadfa8
    • Miklos Szeredi's avatar
      fuse: no RCU mode in fuse_access() · 698fa1d1
      Miklos Szeredi authored
      fuse_access() is never called in RCU walk, only on the final component of
      access(2) and chdir(2)...
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      698fa1d1
    • Miklos Szeredi's avatar
      fuse: readdirplus: fix RCU walk · 6314efee
      Miklos Szeredi authored
      Doing dput(parent) is not valid in RCU walk mode.  In RCU mode it would
      probably be okay to update the parent flags, but it's actually not
      necessary most of the time...
      
      So only set the FUSE_I_ADVISE_RDPLUS flag on the parent when the entry was
      recently initialized by READDIRPLUS.
      
      This is achieved by setting FUSE_I_INIT_RDPLUS on entries added by
      READDIRPLUS and only dropping out of RCU mode if this flag is set.
      FUSE_I_INIT_RDPLUS is cleared once the FUSE_I_ADVISE_RDPLUS flag is set in
      the parent.
      Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: stable@vger.kernel.org
      6314efee
    • Miklos Szeredi's avatar
      fuse: don't check_submounts_and_drop() in RCU walk · 3c70b8ee
      Miklos Szeredi authored
      If revalidate finds an invalid dentry in RCU walk mode, let the VFS deal
      with it instead of calling check_submounts_and_drop() which is not prepared
      for being called from RCU walk.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: stable@vger.kernel.org
      3c70b8ee
  3. 18 Sep, 2013 2 commits
    • Maxim Patlasov's avatar
      fuse: fix fallocate vs. ftruncate race · 0ab08f57
      Maxim Patlasov authored
      A former patch introducing FUSE_I_SIZE_UNSTABLE flag provided detailed
      description of races between ftruncate and anyone who can extend i_size:
      
      > 1. As in the previous scenario fuse_dentry_revalidate() discovered that i_size
      > changed (due to our own fuse_do_setattr()) and is going to call
      > truncate_pagecache() for some  'new_size' it believes valid right now. But by
      > the time that particular truncate_pagecache() is called ...
      > 2. fuse_do_setattr() returns (either having called truncate_pagecache() or
      > not -- it doesn't matter).
      > 3. The file is extended either by write(2) or ftruncate(2) or fallocate(2).
      > 4. mmap-ed write makes a page in the extended region dirty.
      
      This patch adds necessary bits to fuse_file_fallocate() to protect from that
      race.
      Signed-off-by: default avatarMaxim Patlasov <mpatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: stable@vger.kernel.org
      0ab08f57
    • Maxim Patlasov's avatar
      fuse: wait for writeback in fuse_file_fallocate() · bde52788
      Maxim Patlasov authored
      The patch fixes a race between mmap-ed write and fallocate(PUNCH_HOLE):
      
      1) An user makes a page dirty via mmap-ed write.
      2) The user performs fallocate(2) with mode == PUNCH_HOLE|KEEP_SIZE
         and <offset, size> covering the page.
      3) Before truncate_pagecache_range call from fuse_file_fallocate,
         the page goes to write-back. The page is fully processed by fuse_writepage
         (including end_page_writeback on the page), but fuse_flush_writepages did
         nothing because fi->writectr < 0.
      4) truncate_pagecache_range is called and fuse_file_fallocate is finishing
         by calling fuse_release_nowrite. The latter triggers processing queued
         write-back request which will write stale data to the hole soon.
      
      Changed in v2 (thanks to Brian for suggestion):
       - Do not truncate page cache until FUSE_FALLOCATE succeeded. Otherwise,
         we can end up in returning -ENOTSUPP while user data is already punched
         from page cache. Use filemap_write_and_wait_range() instead.
      Changed in v3 (thanks to Miklos for suggestion):
       - fuse_wait_on_writeback() is prone to livelocks; use fuse_set_nowrite()
         instead. So far as we need a dirty-page barrier only, fuse_sync_writes()
         should be enough.
       - rebased to for-linus branch of fuse.git
      Signed-off-by: default avatarMaxim Patlasov <mpatlasov@parallels.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: stable@vger.kernel.org
      bde52788
  4. 16 Sep, 2013 5 commits
  5. 15 Sep, 2013 7 commits
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · d8efd82e
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
       "These are four patches for three construction sites:
      
         - Fix register decoding for the combination of multi-core processors
           and multi-threading.
      
         - Two more fixes that are part of the ongoing DECstation resurrection
           work.  One of these touches a DECstation-only network driver.
      
         - Finally Markos' trivial build fix for the AP/SP support.
      
        (With this applied now all MIPS defconfigs are building again)"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: kernel: vpe: Make vpe_attrs an array of pointers.
        MIPS: Fix SMP core calculations when using MT support.
        MIPS: DECstation I/O ASIC DMA interrupt handling fix
        MIPS: DECstation HRT initialization rearrangement
      d8efd82e
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86 · cd619e21
      Linus Torvalds authored
      Pull x86 platform updates from Matthew Garrett:
       "Nothing amazing here, almost entirely cleanups and minor bugfixes and
        one bit of hardware enablement in the amilo-rfkill driver"
      
      * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86:
        platform/x86: panasonic-laptop: reuse module_acpi_driver
        samsung-laptop: fix config build error
        platform: x86: remove unnecessary platform_set_drvdata()
        amilo-rfkill: Enable using amilo-rfkill with the FSC Amilo L1310.
        wmi: parse_wdg() should return kernel error codes
        hp_wmi: Fix unregister order in hp_wmi_rfkill_setup()
        platform: replace strict_strto*() with kstrto*()
        x86: irst: use module_acpi_driver to simplify the code
        x86: smartconnect: use module_acpi_driver to simplify the code
        platform samsung-q10: use ACPI instead of direct EC calls
        thinkpad_acpi: add the ability setting TPACPI_LED_NONE by quirk
        thinkpad_acpi: return -NODEV while operating uninitialized LEDs
      cd619e21
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 0375ec58
      Linus Torvalds authored
      Pull misc SCSI driver updates from James Bottomley:
       "This patch set is a set of driver updates (megaraid_sas, fnic, lpfc,
        ufs, hpsa) we also have a couple of bug fixes (sd out of bounds and
        ibmvfc error handling) and the first round of esas2r checker fixes and
        finally the much anticipated big endian additions for megaraid_sas"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (47 commits)
        [SCSI] fnic: fnic Driver Tuneables Exposed through CLI
        [SCSI] fnic: Kernel panic while running sh/nosh with max lun cfg
        [SCSI] fnic: Hitting BUG_ON(io_req->abts_done) in fnic_rport_exch_reset
        [SCSI] fnic: Remove QUEUE_FULL handling code
        [SCSI] fnic: On system with >1.1TB RAM, VIC fails multipath after boot up
        [SCSI] fnic: FC stat param seconds_since_last_reset not getting updated
        [SCSI] sd: Fix potential out-of-bounds access
        [SCSI] lpfc 8.3.42: Update lpfc version to driver version 8.3.42
        [SCSI] lpfc 8.3.42: Fixed issue of task management commands having a fixed timeout
        [SCSI] lpfc 8.3.42: Fixed inconsistent spin lock usage.
        [SCSI] lpfc 8.3.42: Fix driver's abort loop functionality to skip IOs already getting aborted
        [SCSI] lpfc 8.3.42: Fixed failure to allocate SCSI buffer on PPC64 platform for SLI4 devices
        [SCSI] lpfc 8.3.42: Fix WARN_ON when driver unloads
        [SCSI] lpfc 8.3.42: Avoided making pci bar ioremap call during dual-chute WQ/RQ pci bar selection
        [SCSI] lpfc 8.3.42: Fixed driver iocbq structure's iocb_flag field running out of space
        [SCSI] lpfc 8.3.42: Fix crash on driver load due to cpu affinity logic
        [SCSI] lpfc 8.3.42: Fixed logging format of setting driver sysfs attributes hard to interpret
        [SCSI] lpfc 8.3.42: Fixed back to back RSCNs discovery failure.
        [SCSI] lpfc 8.3.42: Fixed race condition between BSG I/O dispatch and timeout handling
        [SCSI] lpfc 8.3.42: Fixed function mode field defined too small for not recognizing dual-chute mode
        ...
      0375ec58
    • Linus Torvalds's avatar
      Merge branch 'slab/next' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux · bff157b3
      Linus Torvalds authored
      Pull SLAB update from Pekka Enberg:
       "Nothing terribly exciting here apart from Christoph's kmalloc
        unification patches that brings sl[aou]b implementations closer to
        each other"
      
      * 'slab/next' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux:
        slab: Use correct GFP_DMA constant
        slub: remove verify_mem_not_deleted()
        mm/sl[aou]b: Move kmallocXXX functions to common code
        mm, slab_common: add 'unlikely' to size check of kmalloc_slab()
        mm/slub.c: beautify code for removing redundancy 'break' statement.
        slub: Remove unnecessary page NULL check
        slub: don't use cpu partial pages on UP
        mm/slub: beautify code for 80 column limitation and tab alignment
        mm/slub: remove 'per_cpu' which is useless variable
      bff157b3
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 8bf5e36d
      Linus Torvalds authored
      Pull input update from Dmitry Torokhov:
       "The only change is David Hermann's new EVIOCREVOKE evdev ioctl that
        allows safely passing file descriptors to input devices to session
        processes and later being able to stop delivery of events through
        these fds so that inactive sessions will no longer receive user input
        that does not belong to them"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: evdev - add EVIOCREVOKE ioctl
      8bf5e36d
    • Linus Torvalds's avatar
      vfs: fix typo in comment in recent dentry work · 05a8252b
      Linus Torvalds authored
      Sedat points out that I transposed some letters in "LRU" and wrote "RLU"
      instead in one of the new comments explaining the flow.  Let's just fix
      it.
      Reported-by: default avatarSedat Dilek <sedat.dilek@jpberlin.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      05a8252b
    • Davidlohr Bueso's avatar
      partitions/efi: loosen check fot pmbr size in lba · 6b02fa59
      Davidlohr Bueso authored
      Matt found that commit 27a7c642 ("partitions/efi: account for pmbr
      size in lba") caused his GPT formatted eMMC device not to boot.  The
      reason is that this commit enforced Linux to always check the lesser of
      the whole disk or 2Tib for the pMBR size in LBA.  While most disk
      partitioning tools out there create a pMBR with these characteristics,
      Microsoft does not, as it always sets the entry to the maximum 32-bit
      limitation - even though a drive may be smaller than that[1].
      
      Loosen this check and only verify that the size is either the whole disk
      or 0xFFFFFFFF.  No tool in its right mind would set it to any value
      other than these.
      
      [1] http://thestarman.pcministry.com/asm/mbr/GPT.htm#GPTPTReported-and-tested-by: default avatarMatt Porter <matt.porter@linaro.org>
      Signed-off-by: default avatarDavidlohr Bueso <davidlohr@hp.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6b02fa59
  6. 14 Sep, 2013 2 commits
  7. 13 Sep, 2013 9 commits