diff --git a/src/bdev_state_handler.c b/src/bdev_state_handler.c index c29b48df..e62a34be 100644 --- a/src/bdev_state_handler.c +++ b/src/bdev_state_handler.c @@ -61,7 +61,6 @@ int __handle_bdev_mount_nowrite(const struct vfsmount *mnt, int ret; unsigned int i; struct snap_device *dev; - tracer_for_each(dev, i) { if (!dev || !test_bit(ACTIVE, &dev->sd_state) || @@ -69,19 +68,15 @@ int __handle_bdev_mount_nowrite(const struct vfsmount *mnt, dev->sd_base_dev != mnt->mnt_sb->s_bdev) continue; - // if we are unmounting the vfsmount we are using go to dormant - // state - if (mnt == dattobd_get_mnt(dev->sd_cow->filp)) { - LOG_DEBUG("block device umount detected for device %d", - i); auto_transition_dormant(i); ret = 0; goto out; - } + } i = 0; ret = -ENODEV; + LOG_DEBUG("block device umount has not been detected for device"); out: *idx_out = i; return ret; @@ -185,18 +180,18 @@ int handle_bdev_mount_event(const char *dir_name, int follow_flags, struct path path; struct block_device *bdev; - //LOG_DEBUG("ENTER %s", __func__); + LOG_DEBUG("ENTER %s", __func__); if (!(follow_flags & UMOUNT_NOFOLLOW)) lookup_flags |= LOOKUP_FOLLOW; #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0) - ret = kern_path(dir_name, lookup_flags, &path); + ret = kern_path(dir_name, LOOKUP_FOLLOW, &path); #else ret = user_path_at(AT_FDCWD, dir_name, lookup_flags, &path); #endif //LINUX_VERSION_CODE - //LOG_DEBUG("path->dentry: %s, path->mnt->mnt_root: %s", path.dentry->d_name.name, path.mnt->mnt_root->d_name.name); + LOG_DEBUG("path->dentry: %s, path->mnt->mnt_root: %s", path.dentry->d_name.name, path.mnt->mnt_root->d_name.name); if (path.dentry != path.mnt->mnt_root) { // path specified isn't a mount point @@ -208,7 +203,7 @@ int handle_bdev_mount_event(const char *dir_name, int follow_flags, bdev = path.mnt->mnt_sb->s_bdev; if (!bdev) { - //LOG_DEBUG("path specified isn't mounted on a block device"); + LOG_DEBUG("path specified isn't mounted on a block device"); ret = -ENODEV; goto out; } diff --git a/src/bio_helper.c b/src/bio_helper.c index bacca4ca..d40d5099 100644 --- a/src/bio_helper.c +++ b/src/bio_helper.c @@ -734,6 +734,14 @@ int bio_make_read_clone(struct bio_set *bs, struct tracing_params *tp, new_bio->bi_blkg = orig_bio->bi_blkg; } #endif +#ifdef HAVE_BIO_REMAPPED + bio_set_flag(new_bio, BIO_REMAPPED); +#endif +#ifdef HAVE_BIO_QOS_THROTTLED + bio_set_flag(new_bio, BIO_QOS_THROTTLED); +#endif + + bio_set_flag(new_bio, BIO_CLONED); // fill the bio with pages for (i = 0; i < actual_pages; i++) { diff --git a/src/configure-tests/feature-tests/bio_qos_throttled.c b/src/configure-tests/feature-tests/bio_qos_throttled.c new file mode 100644 index 00000000..038ac908 --- /dev/null +++ b/src/configure-tests/feature-tests/bio_qos_throttled.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Copyright (C) 2015 Datto Inc. + */ + +#include "includes.h" + +MODULE_LICENSE("GPL"); + +static inline void dummy(void){ + struct bio *new_bio = NULL; + bio_set_flag(new_bio, BIO_QOS_THROTTLED); +} \ No newline at end of file diff --git a/src/configure-tests/feature-tests/bio_remapped.c b/src/configure-tests/feature-tests/bio_remapped.c new file mode 100644 index 00000000..9674c276 --- /dev/null +++ b/src/configure-tests/feature-tests/bio_remapped.c @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Copyright (C) 2015 Datto Inc. + */ + +#include "includes.h" + +MODULE_LICENSE("GPL"); + +static inline void dummy(void){ + struct bio *new_bio = NULL; + bio_set_flag(new_bio, BIO_REMAPPED); +} \ No newline at end of file diff --git a/src/tracer.c b/src/tracer.c index 5df1a56b..957a1149 100644 --- a/src/tracer.c +++ b/src/tracer.c @@ -913,6 +913,7 @@ static void __tracer_bioset_exit(struct snap_device *dev) */ static void __tracer_destroy_snap(struct snap_device *dev) { + LOG_DEBUG("tracer_destroy_snap"); if (dev->sd_mrf_thread) { LOG_DEBUG("stopping mrf thread"); kthread_stop(dev->sd_mrf_thread); @@ -936,7 +937,7 @@ static void __tracer_destroy_snap(struct snap_device *dev) #ifdef HAVE_BLK_CLEANUP_QUEUE blk_cleanup_queue(dev->sd_queue); #else - blk_mq_destroy_queue(dev->sd_queue); + blk_put_queue(dev->sd_queue); #endif dev->sd_queue = NULL; }