1. 05 Apr, 2016 1 commit
  2. 15 Mar, 2016 5 commits
  3. 22 Jan, 2016 1 commit
    • Al Viro's avatar
      wrappers for ->i_mutex access · 5955102c
      Al Viro authored
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  4. 14 Jan, 2016 2 commits
    • Vladimir Davydov's avatar
      kmemcg: account certain kmem allocations to memcg · 5d097056
      Vladimir Davydov authored
      Mark those kmem allocations that are known to be easily triggered from
      userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
      memcg.  For the list, see below:
       - threadinfo
       - task_struct
       - task_delay_info
       - pid
       - cred
       - mm_struct
       - vm_area_struct and vm_region (nommu)
       - anon_vma and anon_vma_chain
       - signal_struct
       - sighand_struct
       - fs_struct
       - files_struct
       - fdtable and fdtable->full_fds_bits
       - dentry and external_name
       - inode for all filesystems. This is the most tedious part, because
         most filesystems overwrite the alloc_inode method.
      The list is far from complete, so feel free to add more objects.
      Nevertheless, it should be close to "account everything" approach and
      keep most workloads within bounds.  Malevolent users will be able to
      breach the limit, but this was possible even with the former "account
      everything" approach (simply because it did not account everything in
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Bob Peterson's avatar
      GFS2: Check if iopen is held when deleting inode · 7508abc4
      Bob Peterson authored
      This patch fixes an error condition in which an inode is partially
      created in gfs2_create_inode() but then some error is discovered,
      which causes it to fail and call iput() before the iopen glock is
      created or held. In that case, gfs2_delete_inode would try to
      unlock an iopen glock that doesn't yet exist. Therefore, we test
      its holder (which must exist) for the HIF_HOLDER bit before trying
      to dq it.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Acked-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
  5. 06 Jan, 2016 1 commit
  6. 30 Dec, 2015 1 commit
  7. 24 Dec, 2015 1 commit
  8. 22 Dec, 2015 1 commit
  9. 18 Dec, 2015 5 commits
  10. 14 Dec, 2015 7 commits
    • Benjamin Marzinski's avatar
      gfs2: clear journal live bit in gfs2_log_flush · 400ac52e
      Benjamin Marzinski authored
      When gfs2 was unmounting filesystems or changing them to read-only it
      was clearing the SDF_JOURNAL_LIVE bit before the final log flush.  This
      caused a race.  If an inode glock got demoted in the gap between
      clearing the bit and the shutdown flush, it would be unable to reserve
      log space to clear out the active items list in inode_go_sync, causing an
      error in inode_go_inval because the glock was still dirty.
      To solve this, the SDF_JOURNAL_LIVE bit is now cleared inside the
      shutdown log flush.  This means that, because of the locking on the log
      blocks, either inode_go_sync will be able to reserve space to clean the
      glock before the shutdown flush, or the shutdown flush will clean the
      glock itself, before inode_go_sync fails to reserve the space. Either
      way, the glock will be clean before inode_go_inval.
      Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Benjamin Marzinski's avatar
      gfs2: change gfs2 readdir cookie · 471f3db2
      Benjamin Marzinski authored
      gfs2 currently returns 31 bits of filename hash as a cookie that readdir
      uses for an offset into the directory.  When there are a large number of
      directory entries, the likelihood of a collision goes up way too
      quickly.  GFS2 will now return cookies that are guaranteed unique for a
      while, and then fail back to using 30 bits of filename hash.
      Specifically, the directory leaf blocks are divided up into chunks based
      on the minimum size of a gfs2 directory entry (48 bytes). Each entry's
      cookie is based off the chunk where it starts, in the linked list of
      leaf blocks that it hashes to (there are 131072 hash buckets). Directory
      entries will have unique names until they take reach chunk 8192.
      Assuming the largest filenames possible, and the least efficient spacing
      possible, this new method will still be able to return unique names when
      the previous method has statistically more than a 99% chance of a
      collision.  The non-unique names it fails back to are guaranteed to not
      collide with the unique names.
      unique cookies will be in this format:
      - 1 bit "0" to make sure the the returned cookie is positive
      - 17 bits for the hash table index
      - 1 bit for the mode "0"
      - 13 bits for the offset
      non-unique cookies will be in this format:
      - 1 bit "0" to make sure the the returned cookie is positive
      - 17 bits for the hash table index
      - 1 bit for the mode "1"
      - 13 more bits of the name hash
      Another benefit of location based cookies, is that once a directory's
      exhash table is fully extended (so that multiple hash table indexs do
      not use the same leaf blocks), gfs2 can skip sorting the directory
      entries until it reaches the non-unique ones, and then it only needs to
      sort these. This provides a significant speed up for directory reads of
      very large directories.
      The only issue is that for these cookies to continue to point to the
      correct entry as files are added and removed from the directory, gfs2
      must keep the entries at the same offset in the leaf block when they are
      split (see my previous patch). This means that until all the nodes in a
      cluster are running with code that will split the directory leaf blocks
      this way, none of the nodes can use the new cookie code. To deal with
      this, gfs2 now has the mount option loccookie, which, if set, will make
      it return these new location based cookies.  This option must not be set
      until all nodes in the cluster are at least running this version of the
      kernel code, and you have guaranteed that there are no outstanding
      cookies required by other software, such as NFS.
      gfs2 uses some of the extra space at the end of the gfs2_dirent
      structure to store the calculated readdir cookies. This keeps us from
      needing to allocate a seperate array to hold these values.  gfs2
      recomputes the cookie stored in de_cookie for every readdir call.  The
      time it takes to do so is small, and if gfs2 expected this value to be
      saved on disk, the new code wouldn't work correctly on filesystems
      created with an earlier version of gfs2.
      One issue with adding de_cookie to the union in the gfs2_dirent
      structure is that it caused the union to align itself to a 4 byte
      boundary, instead of its previous 2 byte boundary. This changed the
      offset of de_rahead. To solve that, I pulled de_rahead out of the union,
      since it does not need to be there.
      Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Benjamin Marzinski's avatar
      gfs2: keep offset when splitting dir leaf blocks · 34017472
      Benjamin Marzinski authored
      Currently, when gfs2 splits a directory leaf block, the dirents that
      need to be copied to the new leaf block are packed into the start of it.
      This is good for space efficiency. However, if gfs2 were to copy those
      dirents into the exact same offset in the new leaf block as they had in
      the old block, it would be able to generate a readdir cookie based on
      the dirent location, that would be guaranteed to be unique up well past
      where the current code is statistically almost guaranteed to have
      collisions. So, gfs2 now keeps the dirent's offset in the block the
      same when it copies it to the new leaf block.
      Signed-off-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Bob Peterson's avatar
      GFS2: Reintroduce a timeout in function gfs2_gl_hash_clear · 2aba1b5b
      Bob Peterson authored
      At some point in the past, we used to have a timeout when GFS2 was
      unmounting, trying to clear out its glocks. If the timeout expires,
      it would dump the remaining glocks to the kernel messages so that
      developers can debug the problem. That timeout was eliminated,
      probably by accident. This patch reintroduces it.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Bob Peterson's avatar
      GFS2: Update master statfs buffer with sd_statfs_spin locked · 901c6c66
      Bob Peterson authored
      Before this patch, function update_statfs called gfs2_statfs_change_out
      to update the master statfs buffer without the sd_statfs_spin held.
      In theory, another process could call gfs2_statfs_sync, which takes
      the sd_statfs_spin lock and re-reads m_sc from the buffer. So there's
      a theoretical timing window in which one process could write the
      master statfs buffer, then another comes along and re-reads it, wiping
      out the changes.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Bob Peterson's avatar
      GFS2: Reduce size of incore inode · b58bf407
      Bob Peterson authored
      This patch makes no functional changes. Its goal is to reduce the
      size of the gfs2 inode in memory by rearranging structures and
      changing the size of some variables within the structure.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
    • Bob Peterson's avatar
      GFS2: Make rgrp reservations part of the gfs2_inode structure · a097dc7e
      Bob Peterson authored
      Before this patch, multi-block reservation structures were allocated
      from a special slab. This patch folds the structure into the gfs2_inode
      structure. The disadvantage is that the gfs2_inode needs more memory,
      even when a file is opened read-only. The advantages are: (a) we don't
      need the special slab and the extra time it takes to allocate and
      deallocate from it. (b) we no longer need to worry that the structure
      exists for things like quota management. (c) This also allows us to
      remove the calls to get_write_access and put_write_access since we
      know the structure will exist.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
  11. 08 Dec, 2015 1 commit
    • Al Viro's avatar
      replace ->follow_link() with new method that could stay in RCU mode · 6b255391
      Al Viro authored
      new method: ->get_link(); replacement of ->follow_link().  The differences
      	* inode and dentry are passed separately
      	* might be called both in RCU and non-RCU mode;
      the former is indicated by passing it a NULL dentry.
      	* when called that way it isn't allowed to block
      and should return ERR_PTR(-ECHILD) if it needs to be called
      in non-RCU mode.
      It's a flagday change - the old method is gone, all in-tree instances
      converted.  Conversion isn't hard; said that, so far very few instances
      do not immediately bail out when called in RCU mode.  That'll change
      in the next commits.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  12. 06 Dec, 2015 2 commits
  13. 24 Nov, 2015 1 commit
    • Bob Peterson's avatar
      GFS2: Extract quota data from reservations structure (revert 5407e242) · b54e9a0b
      Bob Peterson authored
      This patch basically reverts the majority of patch 5407e242.
      That patch eliminated the gfs2_qadata structure in favor of just
      using the reservations structure. The problem with doing that is that
      it increases the size of the reservations structure. That is not an
      issue until it comes time to fold the reservations structure into the
      inode in memory so we know it's always there. By separating out the
      quota structure again, we aren't punishing the non-quota users by
      making all the inodes bigger, requiring more slab space. This patch
      creates a new slab area to allocate the quota stuff so it's managed
      a little more sanely.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
  14. 18 Nov, 2015 1 commit
  15. 16 Nov, 2015 3 commits
  16. 13 Nov, 2015 1 commit
  17. 10 Nov, 2015 1 commit
  18. 09 Nov, 2015 2 commits
  19. 04 Nov, 2015 1 commit
  20. 29 Oct, 2015 1 commit
  21. 22 Oct, 2015 1 commit