<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Mingming Cao &lt;cmm@us.ibm.com&gt;

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(&amp;ei-&gt;i_rsv_window.rsv_goal_size);
-		return put_user(rsv_window_size, (int *)arg);
+		if (test_opt(inode-&gt;i_sb, RESERVATION) &amp;&amp; S_ISREG(inode-&gt;i_mode)) {
+			rsv_window_size = atomic_read(&amp;ei-&gt;i_rsv_window.rsv_goal_size);
+			return put_user(rsv_window_size, (int *)arg);
+		}
+		return -ENOTTY;
 	case EXT3_IOC_SETRSVSZ:
+		if (!test_opt(inode-&gt;i_sb, RESERVATION) ||!S_ISREG(inode-&gt;i_mode))
+			return -ENOTTY;
+
 		if (IS_RDONLY(inode))
 			return -EROFS;
 

_
</pre></body></html>