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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 5 Aug 2011 13:34:56 +1000
From:	NeilBrown <neilb@...e.de>
To:	Al Viro <viro@...iv.linux.org.uk>
Cc:	Josef Bacik <josef@...hat.com>, Jan Kara <jack@...e.cz>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Subject: [PATCH] Restore 'fsync' functionality on block devices.


Commit 02c24a82187d5a628c68edfe71ae60dc135cd178:

  fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers

broke fsync on block devices as it did not push the
"filemap_write_and_wait" call down into blkdev_fsync.

(it didn't push it down into ps3flash_flush either, but maybe there is
a reason for that).

So call filemap_write_and_wait from blkdev_fsync following the pattern
that was originally in vfs_fsync_range.

Signed-off-by: NeilBrown <neilb@...e.de>
Cc: Jan Kara <jack@...e.cz>
Cc: Josef Bacik <josef@...hat.com>
Cc: Al Viro <viro@...iv.linux.org.uk>

diff --git a/fs/block_dev.c b/fs/block_dev.c
index f286805..532fefe 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -386,8 +386,10 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t
end, int datasync) {
 	struct inode *bd_inode = filp->f_mapping->host;
 	struct block_device *bdev = I_BDEV(bd_inode);
-	int error;
+	int error, ret;
+
 
+	ret = filemap_write_and_wait_range(filp->f_mapping, start, end);
 	/*
 	 * There is no need to serialise calls to blkdev_issue_flush with
 	 * i_mutex and doing so causes performance issues with concurrent
@@ -396,6 +398,8 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t
end, int datasync) error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL);
 	if (error == -EOPNOTSUPP)
 		error = 0;
+	if (ret)
+		return ret;
 
 	return error;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ