
From: Mingming Cao <cmm@us.ibm.com>

Only allow application to modify the file's reservation window size when fs is
mounted with reservation and the operation is performed on regular files.


---

 25-akpm/fs/ext3/ioctl.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -puN fs/ext3/ioctl.c~ext3-reservation-file-ioctl-fix fs/ext3/ioctl.c
--- 25/fs/ext3/ioctl.c~ext3-reservation-file-ioctl-fix	2004-04-23 23:08:44.169833016 -0700
+++ 25-akpm/fs/ext3/ioctl.c	2004-04-23 23:08:44.172832560 -0700
@@ -153,9 +153,15 @@ flags_err:
 		}
 #endif
 	case EXT3_IOC_GETRSVSZ:
-		rsv_window_size = atomic_read(&ei->i_rsv_window.rsv_goal_size);
-		return put_user(rsv_window_size, (int *)arg);
+		if (test_opt(inode->i_sb, RESERVATION) && S_ISREG(inode->i_mode)) {
+			rsv_window_size = atomic_read(&ei->i_rsv_window.rsv_goal_size);
+			return put_user(rsv_window_size, (int *)arg);
+		}
+		return -ENOTTY;
 	case EXT3_IOC_SETRSVSZ:
+		if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
+			return -ENOTTY;
+
 		if (IS_RDONLY(inode))
 			return -EROFS;
 

_
