diff options
author | james harvey <jamespharvey20@gmail.com> | 2018-06-06 02:30:41 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-06 15:03:33 +0200 |
commit | 7c5a355b747215f05a2b94d7efad3ea3c0218763 (patch) | |
tree | 166b525df073b1f09ed50473ea764ed67be41ba7 /Makefile.inc.in | |
parent | ef00e4264c6d113e4ba2d377520ff61d5775be39 (diff) |
btrfs-progs: btrfs_close_devices: only fsync if device->writeable is set
Prevent unnecessary error from failing fsync(), if opened read only.
Performed 'grep "writeable = " *.h *.c' to make sure there were no odd
situations where fsync() might still be desired here. They're all straight-
forward. The only situation where writeable will be 0 is if btrfs_open_devices
is given flags without O_RDWR. There is no situation where a writeable volume
temporarily becomes unwriteable, or anything like that. Given that it's being
opened O_RDWR, there's no reason to attempt fsync().
utils.c
int btrfs_add_to_fsid() {
...
device->writeable = 1;
volumes.c
int btrfs_close_devices() {
...
while (!list_empty(&fs_devices->devices)) {
...
// just after the fsync() being patched
267: device->writeable = 0;
...
int btrfs_open_devices() {
...
list_for_each_entry(device, &fs_devices->devices, dev_list) {
...
if (flags & O_RDWR)
332: device->writeable = 1
kernel btrfs_close_devices() does not have a corresponding fsync() that I see.
Signed-off-by: James Harvey <jamespharvey20@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Makefile.inc.in')
0 files changed, 0 insertions, 0 deletions