[PATCH 1/1] FS: btrfs, use helpers for rlimits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure compiler won't do weird things with limits. E.g. fetching
them twice may return 2 different values after writable limits are
implemented.

I.e. either use rlimit helpers added in
3e10e716abf3c71bdb5d86b8f507f9e72236c9cd
or ACCESS_ONCE if not applicable.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: Chris Mason <chris.mason@xxxxxxxxxx>
Cc: linux-btrfs@xxxxxxxxxxxxxxx
---
 fs/btrfs/inode.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bbdc870..45bd8a2 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3297,8 +3297,7 @@ static int btrfs_setattr_size(struct inode *inode, struct iattr *attr)
 		return 0;
 
 	if (attr->ia_size > inode->i_size) {
-		unsigned long limit;
-		limit = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
+		unsigned long limit = rlimit(RLIMIT_FSIZE);
 		if (attr->ia_size > inode->i_sb->s_maxbytes)
 			return -EFBIG;
 		if (limit != RLIM_INFINITY && attr->ia_size > limit) {
-- 
1.6.6.1

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

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux