Age | Commit message (Collapse) | Author |
|
|
|
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
|
|
bcachefs multi device filesystems require a bit of hackery, since the
line in /proc/mounts isn't actually a device: when checking if a
bcachefs device has quotas, we return an actually device path in @dev.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
|
quotaio_xfs has a mix of quotactl calls using do_quotactl() and using
quotactl_handle(). This is confusing because the command argument
behaves differently. Convert all places to use quotactl_handle().
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Patches implementing tmpfs quota support, commit 00534e79856c ("Enable
support for tmpfs quotas") in particular, broke quota-tools on XFS
because quotactl(2) syscall got called with wrong arguments. Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When quotactl(2) fails, xfs_read_dquot() will happily return zero-filled
structure. This is fine when the user structure does not exist but it is
wrong when there's other error (like EACCESS). Fix the error handling.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
These days BSD_BEHAVIOUR is really old legacy and there's no point in
doing permission checks in userspace when kernel does it for us. So
disable BSD_BEHAVIOUR by default.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
It is undefined whether getgroups() call will return current egid in the
list of groups it returns. Add an explicit check for egid to the
permission checks performed when BSD_BEHAVIOUR is enabled.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
To achieve so, add a new function quotactl_handle() to the quotaio subsystem,
this will call do_quotactl() with or without a valid quotadev, according to the
filesystem type.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
To be able to set quotas on filesystems without a backing device, quota tools
should be able to use quotactl_fd().
To achieve that, add a new helper, do_quotactl(), to select between quotactl()
and quotactl_fd().
This shouldn't change the semantics of current code. quotactl_fd() will be
called if and only if the handlers contain an empty device, and a valid
mountpoint.
All current calls containing a value device should be still handled by quotactl().
The same is true for calls passing a NULL device on purpose, aiming to sync
active quotas.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
The field holds information if we are searching a directory mountpoint or a
device, rename the field to something more meaningful.
We could switch it to bool, but it seems pointless to include a whole header
just for it, so keep the int type.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Running quota_nld by systemd might cause the problem that systemd
couldn't open the PID file generated by quota_nld. In fact, the PID
file hasn't existed yet because it originates from the child process
of quota_nld which is a daemon process. As the main process exit,
systemd try to access the PID file but the daemon hadn't create it
that time.
In this situation, we move the procedure of creating PID file into the
parent process to ensure the PID file must existed when quota_nld exit.
After that, the above problem would never occur again.
[JK: Fixed up SIGTERM handling and format strings]
Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When user is not over softlimit, there's no point to set the grace time.
The kernel will just ignore it. Output error message instead so that
user is not confused. Also editing of grace times when quotas are
enabled did not really work because we didn't tell the kernel grace
times have changed. Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When setting grace times for a user with only inodes or blocks over
softlimit, setquota(8) was wrongly complaining about not being able to
set the grace time of the non-exceeded entity although it was left
unset. Silence this bogus error message.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Configure scripts need to be runnable with a POSIX-compliant /bin/sh. Replace
== comparison operator (bashism) with = (POSIX) to fix errors:
configure: WARNING: tcpd.h not found
./configure: 8453: test: X: unexpected operator
checking that generated files are newer than configure... done
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Update required gettext version to 0.19 so that newer autoconf macros
get copied. The old ones from 2014 start to have compatibility issues.
Reported-by: Sam James <thesamesam@users.sourceforge.net>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Due to variable assignments getting reordered by automake the variable
man_MANS contained some manpages two times. This then resulted in
complaints when installing the manpages. Avoid the problem by reworking
how the list of manpages is constructed.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Include manpages for features not configured by configure script into
the distribution tarball. This makes the distribution tarball complete.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When quota is configured using --enable-werror, gcc -flto fails with
the following diagnostics:
In function 'strncpy',
inlined from 'sstrncpy' at common.c:107:2,
inlined from 'copy_mntoptarg' at quotasys.c:774:3,
inlined from 'copy_mntoptarg' at quotasys.c:769:13:
/usr/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^
quotasys.c: In function 'copy_mntoptarg':
quotasys.c:774:25: note: length computed here
774 | sstrncpy(buf, optarg, min(buflen, strlen(optarg) + 1));
| ^
This diagnostics is correct: strcpy() copies at most "len" bytes of the string
pointed to by "src", including the terminating null byte, to the buffer
pointed to by "dest".
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When quota is configured using --enable-werror, gcc -flto fails with
the following diagnostics:
In function 'strncat',
inlined from 'sstrncat' at common.c:113:2,
inlined from 'get_proc_num' at quotastats.c:46:2:
/usr/include/bits/string_fortified.h:122:10: error: '__builtin___strncat_chk' specified bound 4096 equals destination size [-Werror=str
ingop-overflow=]
122 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^
This diagnostics is correct: when "src" contains "len" or more bytes,
strncat() writes "len"+1 bytes to "dest" ("len" from "src" plus
the terminating null byte).
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Visible quota files on ext4 filesystem are deprecated. Make sure we
always display the warning message and also expand the message to
explain how the filesystem can be converted.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
term_action.sa_mask is an automatic variable and and thus unitialized.
This patch empties the signal mask.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
quota.h header includes sys/cdefs.h because it uses __P() macro in
quotactl syscall declaration. However glibc currently defines __P() is
nop and it only causes issues with other libc implementations (e.g. musl
libc). So just drop __P() usage and sys/cdefs.h include.
Reported-by: 2xsaiko <git@dblsaiko.net>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When time_t is 32-bit, warn if the kernel returns anything that cannot
fit in these time stamps. This also fixes a compilation warning that
shift exceeds data type size. Similarly when converting data to pass to
kernel, just avoid the pointless shift (generating compiler warning)
when time_t is 32-bit.
Reported-by: "Dmitry V. Levin" <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
When quota is configured using --enable-werror --disable-bsd_behaviour,
the compilation fails with the following diagnostics:
quotaops.c: In function 'getprivs':
quotaops.c:143:1: error: label 'out_err' defined but not used [-Werror=unused-label]
Fixes: 7942290a ("quotaops: Do not leak dquot structures on failure")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
The ret variable inicialization is useless because it is assigned in
all (two) subsequent code branches.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
reallocarray(3) has been added to glibc relatively recently (version
2.26, from 2017) and apparently not all users run new enough glibc. Just
use realloc(3) for now since in this case there's no real risk of
overflow.
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
The tool hasn't been compiled already in the previous version and nobody
complained. Just delete it completely.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Ext4 supports quota using internal quota files for quite some time.
Suggest using this quota feature instead of external quota files if the
kernel is new enough since external quota files on ext4 will be
deprecated.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Add option --filesystem to specify filesystem to report quotas for while
still maintaining the capability of specifying also names to report
quotas for.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Add checks and error handling to report when grace times set for XFS
quotas would overflow.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Add the ability to interpret the larger quota grace period expiration
timestamps that the kernel can export via struct xfs_kern_dqblk.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
xfs_commit_dquot() always set FS_DQ_LIMIT_MASK when calling
Q_XFS_SETQLIM. So far this wasn't a problem since quota tools didn't
support setting of anything else for XFS but now that kernel will start
supporting setting of grace times for XFS, we need to be more careful
and set limits bits only if we really want to update them. Also
FS_DQ_LIMIT_MASK contains real-time limits as well. Quota tools
currently don't support them in any way so avoid telling kernel to set
them.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
xfs quota code doesn't currently allow increasing an individual
user's grace time, but kernel patches are in development for this.
In order for setquota to be able to send this update via
setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying
to update the grace times on an individual user's dquot.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned
timer information for the first quota type which was found to be
enabled.
As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls")
the kernel now honors the quota type requested, so send that from the
Q_XFS_GETQSTAT calls in quota tools.
Older kernels ignore the type altogether, so this change should be
backwards compatible with no change in behavior.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
quota(1) command ignores file systems without enabled quotas. (In
contrast to "quota -f".) This works for local file systems and it used
to work for NFS file system until commit 4cd287f3fa38 ("rpc: Clarify error
message when cannot connect to rpc.rquotad"). quota(1) command now reports
an error whenever at least one NFS-mounted file system has disabled the
quotas. This renders the tool unusable.
This patch readds an exception for the ENOENT errno that was removed
with the commit probably by a mistake.
[JK: Improve commit message, make getprivs() print more descriptive
message in case quota is not enabled]
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Running warnquota under valgrind reported many "Conditional jump or
move depends on uninitialised value" mistakes because readconfigfile()
did not initizalize ldap_bindpw member if some of the configuration
options were missing from the configuration file.
This patch simply initializes all bytes of the configparams structure
to 0 instead of settting each of the members explicitly.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
ldap_get_option(3) documents that a pointer set by
LDAP_OPT_DIAGNOSTIC_MESSAGE must be freed with ldap_memfree(3).
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
While Filesystem Hierarchy Standard prescribes /var/run path for
storing PID files, some (systemd-based) distributions uses /run.
This patch adds a --with-pid-dir=DIRECTORY option to the ./configure
script. The option enables to change the path. Default one is
/var/run as used to be until now.
(I did not use $localstatedir environment variable because Autoconf
manual allows using "precious" variables only in a makefile.)
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Clarify that CC_TO field from warnquota.conf gets resolved through LDAP
lookup similarly to normal message recifient.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
LDAP library provides additional error information in some cases. Print
it make debugging LDAP setup easier.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
ldap_search_ext_s() and ldap_sasl_bind_s() can return also positive
error result codes. Catch them properly.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Currently warnquota ignores unknown variables, or lines we cannot parse
in the config file. This is potentially dangerous as that may result
in errors being missed and warnquota operating differently than
administrator intended. Change warnquota to abort on errors in config
file and provide -I option for ignoring errors for backward
compatibility.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
The help text was wrongly saying that -v is equivalent to --version.
It should be -V.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
Currently when filesystem tracks quotas in hidden quota files (but is
also capable of tracking it in regular files), we scan the whole
filesystem and only after that find out we cannot actually make use of
newly created quota files. Just detect this case before scanning the fs
and skip it.
Signed-off-by: Jan Kara <jack@suse.cz>
|