linux/fs/gfs2/quota.h
Linus Torvalds 1a0507d878 gfs2 fixes
- Don't update inode timestamps for direct writes (performance regression fix).
 
 - Skip no-op quota records instead of panicing.
 
 - Fix a RCU race in gfs2_permission().
 
 - Various other smaller fixes and cleanups all over the place.
 -----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCAAyFiEEJZs3krPW0xkhLMTc1b+f6wMTZToFAmVKReAUHGFncnVlbmJh
 QHJlZGhhdC5jb20ACgkQ1b+f6wMTZTqZ0Q//RigZFdejtWEJ2GnrZfHCRxXXjF7A
 uXyK8PKv6xaHmF+I4PcEr/5yBkOxPhld0sBcsqdNUlvFbEl4AqLrXoSTMB2Fbq2h
 ycPTSPdGTFWjFJBIpN5F1LOQ0urxuS+fKkmxruaFwNywZqbPY0fYs7ZN5K76y0cL
 OKBcbOg5Q39Z+fqrxB0mf7WNIBfUxAsdelGQM3VK1ptNNxebmvBdNaWIhG7vWyWm
 MpWpPRwm906tOrMwhmy1oCCY6RrVC2naLlROOi58iodQ9sIF4MqmKOoejbbll6BH
 1XMtOPQfO+IWWhq0/AX/xBL+nxuukko6V72Qg15e4sDhbla+vYrYEs4P+MZ5UU0u
 dM1MxnmV3xjKBw8KrnwMZL88ExuBhm6HLzKWlshJ4wye21Y3s2OKA2zCK2u3NBc3
 GwYtNLBidoe8TjVD0ZeKeQJt2nZeKRrIWqQteaTHYpLHlRzCajEpmFS+ejEu59WC
 8qw8MjTR2P6m8bPYNTbvxh6Lw4cE6ZHCj71nSPwrEDeU2QPQAmMKQg0bgTM7vpU7
 HKl92Av20xhM+vyb/N670KcR/4yXEkUtbOzazyj/r/XB361luCFP9D9dRiNl7tOo
 TU0otksrkjJ7QrnVd3XUrA2N7iQEIeCVcx0k+KTGrJh7+yVzbUKaJ5W4Tsd+TVzB
 h/lfHAYS4FTd8nA=
 =YfOA
 -----END PGP SIGNATURE-----

Merge tag 'gfs2-v6.6-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:

 - Don't update inode timestamps for direct writes (performance
   regression fix)

 - Skip no-op quota records instead of panicing

 - Fix a RCU race in gfs2_permission()

 - Various other smaller fixes and cleanups all over the place

* tag 'gfs2-v6.6-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: (24 commits)
  gfs2: don't withdraw if init_threads() got interrupted
  gfs2: remove dead code in add_to_queue
  gfs2: Fix slab-use-after-free in gfs2_qd_dealloc
  gfs2: Silence "suspicious RCU usage in gfs2_permission" warning
  gfs2: fs: derive f_fsid from s_uuid
  gfs2: No longer use 'extern' in function declarations
  gfs2: Rename gfs2_lookup_{ simple => meta }
  gfs2: Convert gfs2_internal_read to folios
  gfs2: Convert stuffed_readpage to folios
  gfs2: Minor gfs2_write_jdata_batch PAGE_SIZE cleanup
  gfs2: Get rid of gfs2_alloc_blocks generation parameter
  gfs2: Add metapath_dibh helper
  gfs2: Clean up quota.c:print_message
  gfs2: Clean up gfs2_alloc_parms initializers
  gfs2: Two quota=account mode fixes
  gfs2: Stop using GFS2_BASIC_BLOCK and GFS2_BASIC_BLOCK_SHIFT
  gfs2: setattr_chown: Add missing initialization
  gfs2: fix an oops in gfs2_permission
  gfs2: ignore negated quota changes
  gfs2: Don't update inode timestamps for direct writes
  ...
2023-11-07 11:54:17 -08:00

69 lines
2.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
*/
#ifndef __QUOTA_DOT_H__
#define __QUOTA_DOT_H__
#include <linux/list_lru.h>
struct gfs2_inode;
struct gfs2_sbd;
#define NO_UID_QUOTA_CHANGE INVALID_UID
#define NO_GID_QUOTA_CHANGE INVALID_GID
int gfs2_qa_get(struct gfs2_inode *ip);
void gfs2_qa_put(struct gfs2_inode *ip);
int gfs2_quota_hold(struct gfs2_inode *ip, kuid_t uid, kgid_t gid);
void gfs2_quota_unhold(struct gfs2_inode *ip);
int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid);
void gfs2_quota_unlock(struct gfs2_inode *ip);
int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid,
struct gfs2_alloc_parms *ap);
void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
kuid_t uid, kgid_t gid);
int gfs2_quota_sync(struct super_block *sb, int type);
int gfs2_quota_refresh(struct gfs2_sbd *sdp, struct kqid qid);
int gfs2_quota_init(struct gfs2_sbd *sdp);
void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
int gfs2_quotad(void *data);
void gfs2_wake_up_statfs(struct gfs2_sbd *sdp);
static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
struct gfs2_alloc_parms *ap)
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
int ret;
ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
if (capable(CAP_SYS_RESOURCE) ||
sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
return 0;
ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
if (ret)
return ret;
if (sdp->sd_args.ar_quota == GFS2_QUOTA_ACCOUNT)
return 0;
ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid, ap);
if (ret)
gfs2_quota_unlock(ip);
return ret;
}
extern const struct quotactl_ops gfs2_quotactl_ops;
int __init gfs2_qd_shrinker_init(void);
void gfs2_qd_shrinker_exit(void);
extern struct list_lru gfs2_qd_lru;
void __init gfs2_quota_hash_init(void);
#endif /* __QUOTA_DOT_H__ */