Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rhel 9 flags cleanup #323

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/bdev_state_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,22 @@ 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) ||
tracer_read_fail_state(dev) ||
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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions src/bio_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
14 changes: 14 additions & 0 deletions src/configure-tests/feature-tests/bio_qos_throttled.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only

/*
* Copyright (C) 2015 Datto Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2023

*/

#include "includes.h"

MODULE_LICENSE("GPL");

static inline void dummy(void){
struct bio *new_bio = NULL;
bio_set_flag(new_bio, BIO_QOS_THROTTLED);
}
14 changes: 14 additions & 0 deletions src/configure-tests/feature-tests/bio_remapped.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only

/*
* Copyright (C) 2015 Datto Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2023

*/

#include "includes.h"

MODULE_LICENSE("GPL");

static inline void dummy(void){
struct bio *new_bio = NULL;
bio_set_flag(new_bio, BIO_REMAPPED);
}
3 changes: 2 additions & 1 deletion src/tracer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down