1. 28 3月, 2020 3 次提交
    • A
      gfs2: Split gfs2_rsqa_delete into gfs2_rs_delete and gfs2_qa_put · 1595548f
      Andreas Gruenbacher 提交于
      Keeping reservations and quotas separate helps reviewing the code.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      1595548f
    • B
      gfs2: Change inode qa_data to allow multiple users · 2fba46a0
      Bob Peterson 提交于
      Before this patch, multiple users called gfs2_qa_alloc which allocated
      a qadata structure to the inode, if quotas are turned on. Later, in
      file close or evict, the structure was deleted with gfs2_qa_delete.
      But there can be several competing processes who need access to the
      structure. There were races between file close (release) and the others.
      Thus, a release could delete the structure out from under a process
      that relied upon its existence. For example, chown.
      
      This patch changes the management of the qadata structures to be
      a get/put scheme. Function gfs2_qa_alloc has been changed to gfs2_qa_get
      and if the structure is allocated, the count essentially starts out at
      1. Function gfs2_qa_delete has been renamed to gfs2_qa_put, and the
      last guy to decrement the count to 0 frees the memory.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      2fba46a0
    • B
      gfs2: eliminate gfs2_rsqa_alloc in favor of gfs2_qa_alloc · d580712a
      Bob Peterson 提交于
      Before this patch, multiple callers called gfs2_rsqa_alloc to force
      the existence of a reservations structure and a quota data structure
      if needed. However, now the reservations are handled separately, so
      the quota data is only the quota data. So we eliminate the one in
      favor of just calling gfs2_qa_alloc directly.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      d580712a
  2. 07 2月, 2020 2 次提交
  3. 15 11月, 2019 1 次提交
  4. 08 11月, 2019 2 次提交
    • A
      gfs2: Fix end-of-file handling in gfs2_page_mkwrite · 184b4e60
      Andreas Gruenbacher 提交于
      When the filesystem block size is smaller than the page size, the last
      page may contain blocks that lie entirely beyond the end of the file.
      Make sure to only allocate blocks that lie at least partially in the
      file.  Allocating blocks beyond that isn't useful, and what's more, they
      will not be zeroed out and may end up containing random data.
      
      With that change in place, make sure we'll still always unstuff stuffed
      inodes: iomap_writepage and iomap_writepages currently can't handle
      stuffed files.
      
      In addition, simplify and move the end-of-file check further to the top
      in gfs2_page_mkwrite to avoid weird side effects like unstuffing when
      we're not.
      
      Fixes xfstest generic/263.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      184b4e60
    • A
      gfs2: Multi-block allocations in gfs2_page_mkwrite · f53056c4
      Andreas Gruenbacher 提交于
      In gfs2_page_mkwrite's gfs2_allocate_page_backing helper, try to
      allocate as many blocks at once as we need.  Pass in the size of the
      requested allocation.
      
      Fixes: 35af80ae ("gfs2: don't use buffer_heads in gfs2_allocate_page_backing")
      Cc: stable@vger.kernel.org # v5.3+
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      f53056c4
  5. 30 10月, 2019 1 次提交
  6. 23 10月, 2019 1 次提交
  7. 15 10月, 2019 1 次提交
  8. 05 9月, 2019 1 次提交
  9. 03 9月, 2019 1 次提交
    • A
      gfs2: Always mark inode dirty in fallocate · 0a6a4abc
      Andreas Gruenbacher 提交于
      When allocating space with fallocate, always update the file timestamps
      and mark the inode dirty, no matter if the FALLOC_FL_KEEP_SIZE flag is
      set or not.  The inode needs to be marked dirty so that a subsequent
      fsync will pick it up and any new allocations will make it to disk.
      Filesystems like xfs and ext4 always update the timestamps, so make
      gfs2 behave the same way.
      
      Fixes xfstest generic/483.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      0a6a4abc
  10. 03 7月, 2019 2 次提交
  11. 01 7月, 2019 1 次提交
  12. 28 6月, 2019 1 次提交
  13. 05 6月, 2019 1 次提交
  14. 24 2月, 2019 1 次提交
  15. 01 12月, 2018 1 次提交
  16. 12 10月, 2018 1 次提交
  17. 09 10月, 2018 1 次提交
  18. 25 7月, 2018 3 次提交
  19. 02 7月, 2018 3 次提交
  20. 04 6月, 2018 1 次提交
    • A
      gfs2: Iomap cleanups and improvements · 628e366d
      Andreas Gruenbacher 提交于
      Clean up gfs2_iomap_alloc and gfs2_iomap_get.  Document how
      gfs2_iomap_alloc works: it now needs to be called separately after
      gfs2_iomap_get where necessary; this will be used later by iomap write.
      Move gfs2_iomap_ops into bmap.c.
      
      Introduce a new gfs2_iomap_get_alloc helper and use it in
      fallocate_chunk: gfs2_iomap_begin will become unsuitable for fallocate
      with proper iomap write support.
      
      In gfs2_block_map and fallocate_chunk, zero-initialize struct iomap.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      628e366d
  21. 29 3月, 2018 1 次提交
  22. 09 3月, 2018 1 次提交
    • A
      gfs2: Fix fallocate chunk size · 174d1232
      Andreas Gruenbacher 提交于
      The chunk size of allocations in __gfs2_fallocate is calculated
      incorrectly.  The size can collapse, causing __gfs2_fallocate to
      allocate one block at a time, which is very inefficient.  This needs
      fixing in two places:
      
      In gfs2_quota_lock_check, always set ap->allowed to UINT_MAX to indicate
      that there is no quota limit.  This fixes callers that rely on
      ap->allowed to be set even when quotas are off.
      
      In __gfs2_fallocate, reset max_blks to UINT_MAX in each iteration of the
      loop to make sure that allocation limits from one resource group won't
      spill over into another resource group.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      174d1232
  23. 23 1月, 2018 2 次提交
  24. 19 1月, 2018 1 次提交
  25. 31 10月, 2017 3 次提交
    • A
      gfs2: Fix and clean up {GET,SET}FLAGS ioctl · b16f7e57
      Andreas Gruenbacher 提交于
      Switch to a simple array for mapping between the FS_*_FL and GFS_DIF_*
      flags.  Clarify how the mapping between FS_JOURNAL_DATA_FL and the
      filesystem flags works.  The GFS2_DIF_SYSTEM flag cannot be set from
      user space, so remove it from GFS2_FLAGS_USER_SET.  Fail with -EINVAL
      when trying to set flags that are not supported instead of silently
      ignoring those flags.
      
      Partially fixes xfstest generic/424.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Reviewed-by: NAndrew Price <anprice@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      b16f7e57
    • B
      GFS2: Take inode off order_write list when setting jdata flag · cc555b09
      Bob Peterson 提交于
      This patch fixes a deadlock caused when the jdata flag is set for
      inodes that are already on the ordered write list. Since it is
      on the ordered write list, log_flush calls gfs2_ordered_write which
      calls filemap_fdatawrite. But since the inode had the jdata flag
      set, that calls gfs2_jdata_writepages, which tries to start a new
      transaction. A new transaction cannot be started because it tries
      to acquire the log_flush rwsem which is already locked by the log
      flush operation.
      
      The bottom line is: We cannot switch an inode from ordered to jdata
      until we eliminate any ordered data pages (via log flush) or any
      log_flush operation afterward will create the circular dependency
      above. So we need to flush the log before setting the diskflags to
      switch the file mode, then we need to remove the inode from the
      ordered writes list.
      
      Before this patch, the log flush was done for jdata->ordered, but
      that's wrong. If we're going from jdata to ordered, we don't need
      to call gfs2_log_flush because the call to filemap_fdatawrite will
      do it for us:
      
         filemap_fdatawrite() -> __filemap_fdatawrite_range()
            __filemap_fdatawrite_range() -> do_writepages()
               do_writepages() -> gfs2_jdata_writepages()
                  gfs2_jdata_writepages() -> gfs2_log_flush()
      
      This patch modifies function do_gfs2_set_flags so that if a file
      has its jdata flag set, and it's already on the ordered write list,
      the log will be flushed and it will be removed from the list
      before setting the flag.
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Acked-by: NAbhijith Das <adas@redhat.com>
      cc555b09
    • A
      gfs2: Implement SEEK_HOLE / SEEK_DATA via iomap · 3a27411c
      Andreas Gruenbacher 提交于
      So far, lseek on gfs2 did not report holes.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NBob Peterson <rpeterso@redhat.com>
      3a27411c
  26. 26 9月, 2017 1 次提交
  27. 01 8月, 2017 1 次提交
  28. 18 7月, 2017 1 次提交