linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] FS: btrfs, use helpers for rlimits
@ 2010-02-10 20:00 Jiri Slaby
  2010-02-10 20:01 ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2010-02-10 20:00 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-kernel, jirislaby, linux-btrfs

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@suse.cz>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: linux-btrfs@vger.kernel.org
---
 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 c41db6d..5aa0cef 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3256,8 +3256,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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH 1/1] FS: btrfs, use helpers for rlimits
@ 2010-06-15 13:48 Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2010-06-15 13:48 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-kernel, jirislaby, Jiri Slaby, linux-btrfs

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@suse.cz>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: linux-btrfs@vger.kernel.org
---
 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 44d404c..8f11078 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3576,8 +3576,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.7.1

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH 1/1] FS: btrfs, use helpers for rlimits
@ 2010-01-28 21:44 Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2010-01-28 21:44 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-fsdevel, linux-kernel, jirislaby, linux-btrfs

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@suse.cz>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: linux-btrfs@vger.kernel.org
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-03  8:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-10 20:00 [PATCH 1/1] FS: btrfs, use helpers for rlimits Jiri Slaby
2010-02-10 20:01 ` Chris Mason
2010-09-03  8:23   ` Jiri Slaby
  -- strict thread matches above, loose matches on Subject: below --
2010-06-15 13:48 Jiri Slaby
2010-01-28 21:44 Jiri Slaby

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox