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]
Message-ID: <Pine.LNX.4.64.1008090711040.17515@cobra.newdream.net>
Date:	Mon, 9 Aug 2010 07:33:57 -0700 (PDT)
From:	Sage Weil <sage@...dream.net>
To:	akpm@...ux-foundation.org
cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH] vfs: introduce FS_IOC_SYNCFS to sync a single super

Currently the only way to sync a single super_block (and not all of them 
via sync(2)) is via the BLKFLSBUF ioctl on the block device.  That also 
invalidates the bdev mapping, which isn't usually desireable, and it 
doesn't work for non-block file systems.  The ability to sync a single 
mount can be useful for both applications and administrators (e.g., when 
other mounts on the system are hung).

Introduce a simple ioctl to sync the super associated with an open file.
Pass any error returned by sync_filesystem() back to the user.

Signed-off-by: Sage Weil <sage@...dream.net>
---
 fs/ioctl.c         |    9 +++++++++
 include/linux/fs.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/fs/ioctl.c b/fs/ioctl.c
index 2d140a7..2aabb19 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -593,6 +593,15 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
 	case FS_IOC_FIEMAP:
 		return ioctl_fiemap(filp, arg);
 
+	case FS_IOC_SYNCFS:
+	{
+		struct super_block *sb = filp->f_dentry->d_sb;
+		down_read(&sb->s_umount);
+		error = sync_filesystem(sb);
+		up_read(&sb->s_umount);
+		break;
+	}
+
 	case FIGETBSZ:
 	{
 		struct inode *inode = filp->f_path.dentry->d_inode;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 68ca1b0..175d77f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -321,6 +321,7 @@ struct inodes_stat_t {
 #define	FS_IOC_GETVERSION		_IOR('v', 1, long)
 #define	FS_IOC_SETVERSION		_IOW('v', 2, long)
 #define FS_IOC_FIEMAP			_IOWR('f', 11, struct fiemap)
+#define FS_IOC_SYNCFS                   _IO('f', 12)
 #define FS_IOC32_GETFLAGS		_IOR('f', 1, int)
 #define FS_IOC32_SETFLAGS		_IOW('f', 2, int)
 #define FS_IOC32_GETVERSION		_IOR('v', 1, int)
-- 
1.7.0.4

--
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