1. 15 8月, 2016 1 次提交
    • E
      quota: fill in Q_XGETQSTAT inode information for inactive quotas · 3cd0126d
      Eric Sandeen 提交于
      The manpage for quotactl says that the Q_XGETQSTAT command is
      "useful in finding out how much space is spent to store quota
      information," but the current implementation does not report this
      info if the inode is allocated, but its quota type is not enabled.
      
      This is a change from the earlier XFS implementation, which
      reported information about allocated quota inodes even if their
      quota type was not currently active.
      
      Change quota_getstate() and quota_getstatev() to copy out the inode
      information if the filesystem has provided it, even if the quota
      type for that inode is not currently active.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NBill O'Donnell <billodo@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      3cd0126d
  2. 06 7月, 2016 2 次提交
  3. 18 2月, 2016 1 次提交
    • J
      quota: Forbid Q_GETQUOTA and Q_GETNEXTQUOTA for frozen filesystem · ccf370e4
      Jan Kara 提交于
      Commit 7955118e (quota: Allow Q_GETQUOTA for frozen filesystem)
      allowed Q_GETQUOTA call for frozen filesystem. It makes sense on the
      first look but zero-day testing has shown that with this change ext4
      warns about starting a transaction for frozen filesystem. This happens
      because ext4_acquire_dquot() prepares for allocating space for new quota
      structure. Although it would be possible to implement Q_GETQUOTA for
      ext4 without allocating space for non-existent structures, the matter
      further complicates because OCFS2 needs to update on-disk structure use
      count when a new cluster node loads quota information from disk. So just
      revert the change and forbid Q_GETQUOTA together with Q_GETNEXTQUOTA for
      frozen filesystem. Add comment to quotactl_cmd_write() to save us from
      repeating this excercise in a few years when I forget again.
      Signed-off-by: NJan Kara <jack@suse.cz>
      ccf370e4
  4. 09 2月, 2016 2 次提交
  5. 08 2月, 2016 3 次提交
    • E
      quota: add new quotactl Q_GETNEXTQUOTA · 926132c0
      Eric Sandeen 提交于
      Q_GETNEXTQUOTA is exactly like Q_GETQUOTA, except that it
      will return quota information for the id equal to or greater
      than the id requested.  In other words, if the requested id has
      no quota, the command will return quota information for the
      next higher id which does have a quota set.  If no higher id
      has an active quota, -ESRCH is returned.
      
      This allows filesystems to do efficient iteration in kernelspace,
      much like extN filesystems do in userspace when asked to report
      all active quotas.
      
      This does require a new data structure for userspace, as the
      current structure does not include an ID for the returned quota
      information.
      
      Today, Ext4 with a hidden quota inode requires getpwent-style
      iterations, and for systems which have i.e. LDAP backends,
      this can be very slow, or even impossible if iteration is not
      allowed in the configuration.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      
      926132c0
    • E
      quota: add new quotactl Q_XGETNEXTQUOTA · 8b375249
      Eric Sandeen 提交于
      Q_XGETNEXTQUOTA is exactly like Q_XGETQUOTA, except that it
      will return quota information for the id equal to or greater
      than the id requested.  In other words, if the requested id has
      no quota, the command will return quota information for the
      next higher id which does have a quota set.  If no higher id
      has an active quota, -ESRCH is returned.
      
      This allows filesystems to do efficient iteration in kernelspace,
      much like extN filesystems do in userspace when asked to report
      all active quotas.
      
      The patch adds a d_id field to struct qc_dqblk so that we can
      pass back the id of the quota which was found, and return it
      to userspace.
      
      Today, filesystems such as XFS require getpwent-style iterations,
      and for systems which have i.e. LDAP backends, this can be very
      slow, or even impossible if iteration is not allowed in the
      configuration.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      8b375249
    • E
      quota: remove unused cmd argument from quota_quotaon() · 3218a3ec
      Eric Sandeen 提交于
      The cmd argument to quota_quotaon() via Q_QUOTAON quotactl
      is not used, so remove it.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      3218a3ec
  6. 11 8月, 2015 1 次提交
  7. 04 3月, 2015 5 次提交
  8. 30 1月, 2015 3 次提交
  9. 28 1月, 2015 1 次提交
    • J
      quota: Switch ->get_dqblk() and ->set_dqblk() to use bytes as space units · 14bf61ff
      Jan Kara 提交于
      Currently ->get_dqblk() and ->set_dqblk() use struct fs_disk_quota which
      tracks space limits and usage in 512-byte blocks. However VFS quotas
      track usage in bytes (as some filesystems require that) and we need to
      somehow pass this information. Upto now it wasn't a problem because we
      didn't do any unit conversion (thus VFS quota routines happily stuck
      number of bytes into d_bcount field of struct fd_disk_quota). Only if
      you tried to use Q_XGETQUOTA or Q_XSETQLIM for VFS quotas (or Q_GETQUOTA
      / Q_SETQUOTA for XFS quotas), you got bogus results. Hardly anyone
      tried this but reportedly some Samba users hit the problem in practice.
      So when we want interfaces compatible we need to fix this.
      
      We bite the bullet and define another quota structure used for passing
      information from/to ->get_dqblk()/->set_dqblk. It's somewhat sad we have
      to have more conversion routines in fs/quota/quota.c and another copying
      of quota structure slows down getting of quota information by about 2%
      but it seems cleaner than overloading e.g. units of d_bcount to bytes.
      
      CC: stable@vger.kernel.org
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJan Kara <jack@suse.cz>
      14bf61ff
  10. 10 11月, 2014 1 次提交
  11. 16 7月, 2014 1 次提交
  12. 05 5月, 2014 1 次提交
    • E
      xfs: fix Q_XQUOTARM ioctl · 9da93f9b
      Eric Sandeen 提交于
      The Q_XQUOTARM quotactl was not working properly, because
      we weren't passing around proper flags.  The xfs_fs_set_xstate()
      ioctl handler used the same flags for Q_XQUOTAON/OFF as
      well as for Q_XQUOTARM, but Q_XQUOTAON/OFF look for
      XFS_UQUOTA_ACCT, XFS_UQUOTA_ENFD, XFS_GQUOTA_ACCT etc,
      i.e. quota type + state, while Q_XQUOTARM looks only for
      the type of quota, i.e. XFS_DQ_USER, XFS_DQ_GROUP etc.
      
      Unfortunately these flag spaces overlap a bit, so we
      got semi-random results for Q_XQUOTARM; i.e. the value
      for XFS_DQ_USER == XFS_UQUOTA_ACCT, etc.  yeargh.
      
      Add a new quotactl op vector specifically for the QUOTARM
      operation, since it operates with a different flag space.
      
      This has been broken more or less forever, AFAICT.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Acked-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      
      9da93f9b
  13. 04 11月, 2013 1 次提交
  14. 21 8月, 2013 1 次提交
    • C
      quota: Add a new quotactl command Q_XGETQSTATV · af30cb44
      Chandra Seetharaman 提交于
      XFS now supports three types of quotas (user, group and project).
      
      Current version of Q_XGETSTAT has support for only two types of quotas.
      In order to support three types of quotas, the interface, specifically
      struct fs_quota_stat, need to be expanded. Current version of fs_quota_stat
      does not allow expansion without breaking backward compatibility.
      
      So, a quotactl command and new fs_quota_stat structure need to be added.
      
      This patch adds a new command Q_XGETQSTATV to quotactl() which takes
      a new data structure fs_quota_statv. This new data structure provides
      support for future expansion and backward compatibility.
      
      Callers of the new quotactl command have to set the version of the data
      structure being passed, and kernel will fill as much data as requested.
      If the kernel does not support the user-space provided version, EINVAL
      will be returned. User-space can reduce the version number and call the same
      quotactl again.
      Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Reviewed-by: NRich Johnston <rjohnston@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      
      [v2: Applied rjohnston's suggestions as per Chandra's request. -bpm]
      af30cb44
  15. 13 12月, 2012 1 次提交
  16. 13 10月, 2012 1 次提交
    • J
      vfs: define struct filename and have getname() return it · 91a27b2a
      Jeff Layton 提交于
      getname() is intended to copy pathname strings from userspace into a
      kernel buffer. The result is just a string in kernel space. It would
      however be quite helpful to be able to attach some ancillary info to
      the string.
      
      For instance, we could attach some audit-related info to reduce the
      amount of audit-related processing needed. When auditing is enabled,
      we could also call getname() on the string more than once and not
      need to recopy it from userspace.
      
      This patchset converts the getname()/putname() interfaces to return
      a struct instead of a string. For now, the struct just tracks the
      string in kernel space and the original userland pointer for it.
      
      Later, we'll add other information to the struct as it becomes
      convenient.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      91a27b2a
  17. 18 9月, 2012 1 次提交
    • E
      userns: Convert qutoactl · 74a8a103
      Eric W. Biederman 提交于
      Update the quotactl user space interface to successfull compile with
      user namespaces support enabled and to hand off quota identifiers to
      lower layers of the kernel in struct kqid instead of type and qid
      pairs.
      
      The quota on function is not converted because while it takes a quota
      type and an id.  The id is the on disk quota format to use, which
      is something completely different.
      
      The signature of two struct quotactl_ops methods were changed to take
      struct kqid argumetns get_dqblk and set_dqblk.
      
      The dquot, xfs, and ocfs2 implementations of get_dqblk and set_dqblk
      are minimally changed so that the code continues to work with
      the change in parameter type.
      
      This is the first in a series of changes to always store quota
      identifiers in the kernel in struct kqid and only use raw type and qid
      values when interacting with on disk structures or userspace.  Always
      using struct kqid internally makes it hard to miss places that need
      conversion to or from the kernel internal values.
      
      Cc: Jan Kara <jack@suse.cz>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Ben Myers <bpm@sgi.com>
      Cc: Alex Elder <elder@kernel.org>
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      74a8a103
  18. 23 7月, 2012 1 次提交
  19. 09 7月, 2012 1 次提交
  20. 01 3月, 2012 1 次提交
  21. 14 2月, 2012 1 次提交
    • J
      quota: Fix deadlock with suspend and quotas · dcdbed85
      Jan Kara 提交于
      This script causes a kernel deadlock:
      set -e
      DEVICE=/dev/vg1/linear
      lvchange -ay $DEVICE
      mkfs.ext3 $DEVICE
      mount -t ext3 -o usrquota,grpquota $DEVICE /mnt/test
      quotacheck -gu /mnt/test
      umount /mnt/test
      mount -t ext3 -o usrquota,grpquota $DEVICE /mnt/test
      quotaon /mnt/test
      dmsetup suspend $DEVICE
      setquota -u root 1 2 3 4 /mnt/test &
      sleep 1
      dmsetup resume $DEVICE
      
      setquota acquired semaphore s_umount for read and then tried to perform a
      transaction (and waits because the device is suspended).  dmsetup resume tries
      to acquire s_umount for write before resuming the device (and waits for
      setquota).
      
      Fix the deadlock by grabbing a thawed superblock for quota commands which need
      it.
      Reported-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      dcdbed85
  22. 04 1月, 2012 1 次提交
  23. 01 11月, 2011 1 次提交
  24. 31 10月, 2011 1 次提交
    • C
      writeback: Add a 'reason' to wb_writeback_work · 0e175a18
      Curt Wohlgemuth 提交于
      This creates a new 'reason' field in a wb_writeback_work
      structure, which unambiguously identifies who initiates
      writeback activity.  A 'wb_reason' enumeration has been
      added to writeback.h, to enumerate the possible reasons.
      
      The 'writeback_work_class' and tracepoint event class and
      'writeback_queue_io' tracepoints are updated to include the
      symbolic 'reason' in all trace events.
      
      And the 'writeback_inodes_sbXXX' family of routines has had
      a wb_stats parameter added to them, so callers can specify
      why writeback is being started.
      Acked-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NCurt Wohlgemuth <curtw@google.com>
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      0e175a18
  25. 27 9月, 2011 1 次提交
  26. 13 1月, 2011 1 次提交
    • J
      quota: Fix deadlock during path resolution · f00c9e44
      Jan Kara 提交于
      As Al Viro pointed out path resolution during Q_QUOTAON calls to quotactl
      is prone to deadlocks. We hold s_umount semaphore for reading during the
      path resolution and resolution itself may need to acquire the semaphore
      for writing when e. g. autofs mountpoint is passed.
      
      Solve the problem by performing the resolution before we get hold of the
      superblock (and thus s_umount semaphore). The whole thing is complicated
      by the fact that some filesystems (OCFS2) ignore the path argument. So to
      distinguish between filesystem which want the path and which do not we
      introduce new .quota_on_meta callback which does not get the path. OCFS2
      then uses this callback instead of old .quota_on.
      
      CC: Al Viro <viro@ZenIV.linux.org.uk>
      CC: Christoph Hellwig <hch@lst.de>
      CC: Ted Ts'o <tytso@mit.edu>
      CC: Joel Becker <joel.becker@oracle.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      f00c9e44
  27. 24 5月, 2010 1 次提交
  28. 22 5月, 2010 3 次提交