On 2012/07/13 22:54, Jan Kara wrote:
On Thu 12-07-12 18:10:14, Fernando Luis Vázquez Cao wrote:
The FIISFROZEN ioctl can be use by HA and monitoring software to check
the freeze state of a mounted filesystem.
Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx>
---
diff -urNp vfs-orig/fs/compat_ioctl.c vfs/fs/compat_ioctl.c
--- vfs-orig/fs/compat_ioctl.c 2012-07-04 18:57:54.000000000 +0900
+++ vfs/fs/compat_ioctl.c 2012-07-12 17:25:37.592626439 +0900
@@ -885,6 +885,7 @@ COMPATIBLE_IOCTL(FIGETBSZ)
/* 'X' - originally XFS but some now in the VFS */
COMPATIBLE_IOCTL(FIFREEZE)
COMPATIBLE_IOCTL(FITHAW)
+COMPATIBLE_IOCTL(FIISFROZEN)
COMPATIBLE_IOCTL(KDGETKEYCODE)
COMPATIBLE_IOCTL(KDSETKEYCODE)
COMPATIBLE_IOCTL(KDGKBTYPE)
diff -urNp vfs-orig/fs/ioctl.c vfs/fs/ioctl.c
--- vfs-orig/fs/ioctl.c 2012-07-04 18:57:54.000000000 +0900
+++ vfs/fs/ioctl.c 2012-07-12 17:25:37.592626439 +0900
@@ -536,6 +536,16 @@ static int ioctl_fsthaw(struct file *fil
return thaw_super(sb);
}
+static int ioctl_fs_isfrozen(struct file *filp)
+{
+ struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
+ return isfrozen_super(sb);
+}
+
Is there any reason to restrict this to CAP_SYS_ADMIN?
It is just for consistency with what FIFREEZE and FITHAW require
in terms of ACLs. If it is deemed too strict for a check ioctl I can
remove it.
Thanks,
Fernando
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html