Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Don't use readdir_r() as it is obsolete. Use readdir() instead.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
|
|
Fix the Makefile to put things in a cachefilesd directory when making a
tarball, not in a directory called 'keyutils'.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Turn on PIE and RELRO build hardening for RPM builds.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix the cachefilesd.service file to point to /usr/sbin/cachefilesd rather
than /sbin/cachefilesd.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Use the systemd interaction macros in the pre/post-installation and
pre/post-uninstallation sections rather than open-coding the interaction.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Clear the supplementary groups list when daemonising the process.
This fixes the following issue raised by rpmlint:
cachefilesd.x86_64: E: missing-call-to-setgroups-before-setuid /usr/sbin/cachefilesd
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Newer kernels include the counts of objects and blocks unpinned since last
the status was read over the control device fd. The unpinning is usually
through relinquishment by the netfs.
If these fields are present, extract them and use them to work out whether
there can be anything to cull. The fields are reset when read and POLLIN
is signalled when the file counter is increased from 0.
If there is nothing new to cull, scanning to build a cull table is
suspended until more stuff is available. If the new fields are present,
work on that basis - otherwise we sleep for 30s and try again.
The thresholds at which culling should be resumed can be set by adding:
resume_thresholds <block> <file>
to the config file. The cull scan is retried when sufficient cumulative
unpinning has happened that either threshold is exceeded. The block
threshold watches the cumulative i_blocks for unpinned cache inodes and the
file threshold watches the number of cache inodes unpinned. If either is
"-" then that threshold is disabled. The default is 5 files and no block
threshold.
Further:
(*) Some of the variable names are changed to be more obvious as to what
they do.
(*) If time-based culling is used, then SIGALRM must be blocked between
the did-it-happen check and the call to poll. SIGINT, SIGTERM and
SIGIO are already so blocked.
(*) All the decision making logic is moved into the cachefilesd() function
rather than being spread out.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
When cachefilesd finds that it needs to cull, but that culling doesn't
achieve anything, it sets an alarm to wake it in 30 seconds to try again.
But as read_cache_state() will detect that culling is still needed, it will
immediately try again anyway.
This results in 100% cpu usage of no value.
This patch causes culling to be blocked until the 30 second alarm goes off.
It also changes the test to decide whether to enter poll() after blocking
signals to test exactly those values that might be changed by a signal.
Testing these is important, testing anything else is pointless.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
Add -Wsign-compare to the build as comparisons between a negative signed
int and a positive unsigned int don't compare as expected. Fix up the
comparisons then flagged. This includes moving to zero-based indices for
the cull tables.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Permit culling to be disabled on the command line by passing a -N flag.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Apply some cleanups to cachefilesd:
(1) Use bool rather than int where appropriate.
(2) Don't explicitly initialise static variables to 0 otherwise they'll
end up in .data rather than .bss and use file space.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
(*) Don't set, create or destroy the buildroot.
(*) Use %global rather than %define where possible.
(*) Automatically create the doc directory and move stuff into it using
the %doc file macro.
(*) Don't set a %defattr.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The directory in which the documentation is stored now has no version
included in its name, so remove this from all references to it.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The cachefilesd-selinux RPM no longer exists as its policy has been merged
into the master policy RPM, so scrub the references to it.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The Makefile should be producing compressed tarballs under the name
cachefilesd-<version>.tar.bz2 not uncompressed tarballs. Fix that.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The licence is actually GPLv2+ so put that in the specfile.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
In certain cases, a NULL may be passed along to string library functions.
Not anymore!
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The rpmbuild %dist macro moved from /etc/rpm/macros.dist so look for it more
broadly (it's now in /usr/lib/rpm/macros.d/macros.dist).
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix specfile errors found by rpmlint including:
(1) Bad dates in the changelog.
(2) An uninstalled file.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
"-qab" should be passed to the modprobe in the systemd service file that loads
the cachefiles.ko kernel module.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=754811
Reported-by: Jóhann B. Guðmundsson <johannbg@johannbg@hi.is>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: Dan Horák <dan@danny.cz>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
Provide a makefile rule to run rpmlint on the RPMs it has built.
Fix the complaints made by rpmlint.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix the specfile to require the bits for the _unitdir macro during the build of
an RPM as specified in:
https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
Replace the old init script with a native systemd service definition.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Provide make rules to build tarballs (make tarball) and RPMs (make rpm) from
the GIT tree.
The local build ID can be set whilst building an RPM:
make rpm BUILDID=.foo
This is incorporated into the RPM names after the release number.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
Change the culling info messages to debug level so as not to fill up the disk
space with logs.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix the cachefilesd initscript to:
(1) embed a parseable description for init to use, and
(2) use the appropriate exit codes.
For more information, see:
https://fedoraproject.org/wiki/Packaging/SysVInitScript
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix the RPM Requires dependency on selinux-policy-base to be >=, not =.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
There is no need to log every time the cull table is refilled.
Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Fix a wildchar that should be a dot in a filename in the policy.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Make the initscript to a restorecon on various files to make sure they have the
right security context.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Move the default cache location to /var/cache/fscache to be consistent with
other packages that have caches.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
The SELinux policy is now in the selinux-policy package and so doesn't need to
be here.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Amend the SELinux policy to allow cachefilesd to use rmdir on directories in
the cache. Without this, messages like the following:
node=barsoom.rdu.redhat.com type=AVC msg=audit(1269518332.550:21841): avc:
denied { rmdir } for pid=1670 comm="cachefilesd" name="@b5" dev=dm-0
ino=1177664 scontext=unconfined_u:system_r:cachefilesd_t:s0
tcontext=system_u:object_r:cachefiles_var_t:s0 tclass=dir
in the audit log.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Provide an option to suppress cachefilesd culling. This prevents the daemon
from using up resources scanning the cache. The downside is that it never
attempts to shrink the cache to make space when the cache ends up exceeding
its limits due to other processes using up resources on the same filesystem as
the cache.
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
cachefilesd.c should #include <sys/stat.h> if it's going to use stat() and
related functions [RH BZ 565135].
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
|
The cachefiles module no longer accepts directory fds on cull and inuse
commands, but rather uses current working directory.
Use stat64/fstatat64 to avoid EOVERFLOW errors from the kernel on large files.
|
|
Made cachefilesd ask the kernel whether cullable objects are in use and omit
them from the cull table if they are.
Made the size of cachefilesd's culling tables configurable.
Updated the manual pages.
Documented SELinux interaction.
Include SELinux policy for cachefilesd.
Fixed typo that was causing the howto.txt not to be installed.
Use /dev/cachefiles if it present in preference to /proc/fs/cachefiles.
Use poll rather than SIGURG on /dev/cachefilesd.
|
|
Add a how-to document.
Don't need to predeclare functions with printf attributes - it can be
done on the definition as long as the attribute goes first.
|
|
Mark __error() as attribute format printf
Fix up format errors shown up
|
|
Rerun the scan after a deferral period if the cache is empty for initial scan
Updated init.d script to look for cachefilesd in /sbin
Added postun and preun rules so cachefilesd is stopped and started when the rpm
is updated or removed.
Require /sbin/chkconfig not /usr/bin/chkconfig
|
|
|