lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171012170628.GS3301751@devbig577.frc2.facebook.com>
Date:   Thu, 12 Oct 2017 10:06:28 -0700
From:   Tejun Heo <tj@...nel.org>
To:     dsterba@...e.cz, jack@...e.cz, axboe@...nel.dk, clm@...com,
        jbacik@...com, kernel-team@...com, linux-kernel@...r.kernel.org,
        linux-btrfs@...r.kernel.org
Subject: [PATCH v3 5/5] btrfs: ensure that metadata and flush are issued from
 the root cgroup

Issuing metdata or otherwise shared IOs from !root cgroup can lead to
priority inversion.  This patch ensures that those IOs are always
issued from the root cgroup.

v3: Dropped unnecessary btree_inode handling as suggested by David
    Sterba.

v2: Fixed missing @bh in submit_bh_blkcg_css() call.

Signed-off-by: Tejun Heo <tj@...nel.org>
Reviewed-by: Liu Bo <bo.li.liu@...cle.com>
Cc: David Sterba <dsterba@...e.cz>
Cc: Chris Mason <clm@...com>
Cc: Josef Bacik <jbacik@...com>
---
 fs/btrfs/check-integrity.c |    2 +-
 fs/btrfs/disk-io.c         |    4 ++++
 fs/btrfs/ioctl.c           |    4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2741,7 +2741,7 @@ int btrfsic_submit_bh(int op, int op_fla
 	struct btrfsic_dev_state *dev_state;
 
 	if (!btrfsic_is_initialized)
-		return submit_bh(op, op_flags, bh);
+		return submit_bh_blkcg_css(op, op_flags, bh, blkcg_root_css);
 
 	mutex_lock(&btrfsic_mutex);
 	/* since btrfsic_submit_bh() might also be called before
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1025,6 +1025,8 @@ static blk_status_t btree_submit_bio_hoo
 	int async = check_async_write(bio_flags);
 	blk_status_t ret;
 
+	bio_associate_blkcg(bio, blkcg_root_css);
+
 	if (bio_op(bio) != REQ_OP_WRITE) {
 		/*
 		 * called for a read, do the setup so that checksum validation
@@ -3512,6 +3514,8 @@ static void write_dev_flush(struct btrfs
 		return;
 
 	bio_reset(bio);
+	bio_associate_blkcg(bio, blkcg_root_css);
+
 	bio->bi_end_io = btrfs_end_empty_barrier;
 	bio_set_dev(bio, device->bdev);
 	bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -150,6 +150,10 @@ void btrfs_update_iflags(struct inode *i
 		new_fl |= S_NOATIME;
 	if (ip->flags & BTRFS_INODE_DIRSYNC)
 		new_fl |= S_DIRSYNC;
+	/*
+	 * The btree_inode will be always in the root cgroup. The cgroup
+	 * writeback can be enabled on regular inodes selectively.
+	 */
 	new_fl |= S_CGROUPWB;
 
 	set_mask_bits(&inode->i_flags,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ