All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
@ 2014-08-20  9:42 Jan Stancek
  2014-08-20 13:14 ` chrubis
  2015-01-14  9:15 ` Shuang Qiu
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Stancek @ 2014-08-20  9:42 UTC (permalink / raw)
  To: ltp-list

Using LLONG_MAX as maximum can fail on XFS, because here the maximum
file size is 2^63-1, so this test may unexpectedly succeed.

Impose limit via setrlimit(RLIMIT_FSIZE,..) and set value used
in EFBIG test to be twice that much.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
index ed5073d..54b7d3c 100644
--- a/testcases/kernel/syscalls/truncate/truncate03.c
+++ b/testcases/kernel/syscalls/truncate/truncate03.c
@@ -50,6 +50,7 @@
 #include <string.h>
 #include <signal.h>
 #include <pwd.h>
+#include <sys/resource.h>
 
 #include "test.h"
 #include "usctest.h"
@@ -65,6 +66,7 @@
 #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
 #define DIR_MODE	S_IRWXU
 #define TRUNC_LEN	256
+#define MAX_FSIZE	(16*1024*1024)
 
 static char long_pathname[PATH_MAX + 2];
 
@@ -82,7 +84,7 @@ static struct test_case_t {
 	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
 	{ "", TRUNC_LEN, ENOENT },
 	{ TEST_DIR1, TRUNC_LEN, EISDIR },
-	{ TEST_FILE3, LLONG_MAX, EFBIG },
+	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
 	{ TEST_SYM1, TRUNC_LEN, ELOOP }
 };
 
@@ -124,6 +126,8 @@ void setup(void)
 {
 	struct passwd *ltpuser;
 	char *bad_addr;
+	struct rlimit rlim;
+	sigset_t sigset;
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
@@ -156,6 +160,18 @@ void setup(void)
 
 	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
 	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
+
+	rlim.rlim_cur = MAX_FSIZE;
+	rlim.rlim_max = MAX_FSIZE;
+	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
+	if (TEST_RETURN != 0)
+		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");
+
+	sigemptyset(&sigset);
+	sigaddset(&sigset, SIGXFSZ);
+	TEST(sigprocmask(SIG_BLOCK, &sigset, NULL));
+	if (TEST_RETURN != 0)
+		tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
 }
 
 void truncate_verify(struct test_case_t *tc)
-- 
1.7.1


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
  2014-08-20  9:42 [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test Jan Stancek
@ 2014-08-20 13:14 ` chrubis
  2015-01-14  9:15 ` Shuang Qiu
  1 sibling, 0 replies; 5+ messages in thread
From: chrubis @ 2014-08-20 13:14 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> Using LLONG_MAX as maximum can fail on XFS, because here the maximum
> file size is 2^63-1, so this test may unexpectedly succeed.

I've found this failure on ext3 on SLES as well and tested that the
patch fixes the problem.

> ---
>  testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
>  1 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
> index ed5073d..54b7d3c 100644
> --- a/testcases/kernel/syscalls/truncate/truncate03.c
> +++ b/testcases/kernel/syscalls/truncate/truncate03.c
> @@ -50,6 +50,7 @@
>  #include <string.h>
>  #include <signal.h>
>  #include <pwd.h>
> +#include <sys/resource.h>
>  
>  #include "test.h"
>  #include "usctest.h"
> @@ -65,6 +66,7 @@
>  #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
>  #define DIR_MODE	S_IRWXU
>  #define TRUNC_LEN	256
> +#define MAX_FSIZE	(16*1024*1024)
>  
>  static char long_pathname[PATH_MAX + 2];
>  
> @@ -82,7 +84,7 @@ static struct test_case_t {
>  	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
>  	{ "", TRUNC_LEN, ENOENT },
>  	{ TEST_DIR1, TRUNC_LEN, EISDIR },
> -	{ TEST_FILE3, LLONG_MAX, EFBIG },
> +	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
>  	{ TEST_SYM1, TRUNC_LEN, ELOOP }
>  };
>  
> @@ -124,6 +126,8 @@ void setup(void)
>  {
>  	struct passwd *ltpuser;
>  	char *bad_addr;
> +	struct rlimit rlim;
> +	sigset_t sigset;
>  
>  	tst_sig(NOFORK, DEF_HANDLER, cleanup);
>  
> @@ -156,6 +160,18 @@ void setup(void)
>  
>  	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
>  	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
> +
> +	rlim.rlim_cur = MAX_FSIZE;
> +	rlim.rlim_max = MAX_FSIZE;
> +	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
> +	if (TEST_RETURN != 0)
> +		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");

We have SAFE_SETRLIMIT() but that is merely cometic change.

Otherwise it's acked and tested, and as it fixes testcase regression it
should go in before the release.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
  2014-08-20  9:42 [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test Jan Stancek
  2014-08-20 13:14 ` chrubis
@ 2015-01-14  9:15 ` Shuang Qiu
  2015-01-16  9:26   ` Jan Stancek
  1 sibling, 1 reply; 5+ messages in thread
From: Shuang Qiu @ 2015-01-14  9:15 UTC (permalink / raw)
  To: ltp-list

Hello,
I find that EFBIG test will fail over nfs filesystem because 
unexpectedly succeed too.
It can catch SIGXFSZ signal but will not fail with EFBIG after blocked 
SIGXFSZ.
I'm not sure if it is expected behavior for truncate against nfs filesystem.
Could anyone help to check?

Thanks
Shuang
On 08/20/2014 05:42 PM, Jan Stancek wrote:
> Using LLONG_MAX as maximum can fail on XFS, because here the maximum
> file size is 2^63-1, so this test may unexpectedly succeed.
>
> Impose limit via setrlimit(RLIMIT_FSIZE,..) and set value used
> in EFBIG test to be twice that much.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>   testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
>   1 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
> index ed5073d..54b7d3c 100644
> --- a/testcases/kernel/syscalls/truncate/truncate03.c
> +++ b/testcases/kernel/syscalls/truncate/truncate03.c
> @@ -50,6 +50,7 @@
>   #include <string.h>
>   #include <signal.h>
>   #include <pwd.h>
> +#include <sys/resource.h>
>   
>   #include "test.h"
>   #include "usctest.h"
> @@ -65,6 +66,7 @@
>   #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
>   #define DIR_MODE	S_IRWXU
>   #define TRUNC_LEN	256
> +#define MAX_FSIZE	(16*1024*1024)
>   
>   static char long_pathname[PATH_MAX + 2];
>   
> @@ -82,7 +84,7 @@ static struct test_case_t {
>   	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
>   	{ "", TRUNC_LEN, ENOENT },
>   	{ TEST_DIR1, TRUNC_LEN, EISDIR },
> -	{ TEST_FILE3, LLONG_MAX, EFBIG },
> +	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
>   	{ TEST_SYM1, TRUNC_LEN, ELOOP }
>   };
>   
> @@ -124,6 +126,8 @@ void setup(void)
>   {
>   	struct passwd *ltpuser;
>   	char *bad_addr;
> +	struct rlimit rlim;
> +	sigset_t sigset;
>   
>   	tst_sig(NOFORK, DEF_HANDLER, cleanup);
>   
> @@ -156,6 +160,18 @@ void setup(void)
>   
>   	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
>   	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
> +
> +	rlim.rlim_cur = MAX_FSIZE;
> +	rlim.rlim_max = MAX_FSIZE;
> +	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
> +	if (TEST_RETURN != 0)
> +		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");
> +
> +	sigemptyset(&sigset);
> +	sigaddset(&sigset, SIGXFSZ);
> +	TEST(sigprocmask(SIG_BLOCK, &sigset, NULL));
> +	if (TEST_RETURN != 0)
> +		tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
>   }
>   
>   void truncate_verify(struct test_case_t *tc)


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
  2015-01-14  9:15 ` Shuang Qiu
@ 2015-01-16  9:26   ` Jan Stancek
  2015-01-16  9:33     ` Shuang Qiu
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2015-01-16  9:26 UTC (permalink / raw)
  To: Shuang Qiu; +Cc: ltp-list




----- Original Message -----
> From: "Shuang Qiu" <shuang.qiu@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Cc: "Jan Stancek" <jstancek@redhat.com>
> Sent: Wednesday, 14 January, 2015 10:15:20 AM
> Subject: Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
> 
> Hello,
> I find that EFBIG test will fail over nfs filesystem because
> unexpectedly succeed too.
> It can catch SIGXFSZ signal but will not fail with EFBIG after blocked
> SIGXFSZ.
> I'm not sure if it is expected behavior for truncate against nfs filesystem.
> Could anyone help to check?

I'm guessing a bug. write(2) on nfs respects RLIMIT_FSIZE, but truncate(2) does not.
I think best would be to check with some nfs people: linux-nfs@vger.kernel.org

Regards,
Jan

> 
> Thanks
> Shuang
> On 08/20/2014 05:42 PM, Jan Stancek wrote:
> > Using LLONG_MAX as maximum can fail on XFS, because here the maximum
> > file size is 2^63-1, so this test may unexpectedly succeed.
> >
> > Impose limit via setrlimit(RLIMIT_FSIZE,..) and set value used
> > in EFBIG test to be twice that much.
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >   testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
> >   1 files changed, 17 insertions(+), 1 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/truncate/truncate03.c
> > b/testcases/kernel/syscalls/truncate/truncate03.c
> > index ed5073d..54b7d3c 100644
> > --- a/testcases/kernel/syscalls/truncate/truncate03.c
> > +++ b/testcases/kernel/syscalls/truncate/truncate03.c
> > @@ -50,6 +50,7 @@
> >   #include <string.h>
> >   #include <signal.h>
> >   #include <pwd.h>
> > +#include <sys/resource.h>
> >   
> >   #include "test.h"
> >   #include "usctest.h"
> > @@ -65,6 +66,7 @@
> >   #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
> >   #define DIR_MODE	S_IRWXU
> >   #define TRUNC_LEN	256
> > +#define MAX_FSIZE	(16*1024*1024)
> >   
> >   static char long_pathname[PATH_MAX + 2];
> >   
> > @@ -82,7 +84,7 @@ static struct test_case_t {
> >   	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
> >   	{ "", TRUNC_LEN, ENOENT },
> >   	{ TEST_DIR1, TRUNC_LEN, EISDIR },
> > -	{ TEST_FILE3, LLONG_MAX, EFBIG },
> > +	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
> >   	{ TEST_SYM1, TRUNC_LEN, ELOOP }
> >   };
> >   
> > @@ -124,6 +126,8 @@ void setup(void)
> >   {
> >   	struct passwd *ltpuser;
> >   	char *bad_addr;
> > +	struct rlimit rlim;
> > +	sigset_t sigset;
> >   
> >   	tst_sig(NOFORK, DEF_HANDLER, cleanup);
> >   
> > @@ -156,6 +160,18 @@ void setup(void)
> >   
> >   	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
> >   	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
> > +
> > +	rlim.rlim_cur = MAX_FSIZE;
> > +	rlim.rlim_max = MAX_FSIZE;
> > +	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
> > +	if (TEST_RETURN != 0)
> > +		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");
> > +
> > +	sigemptyset(&sigset);
> > +	sigaddset(&sigset, SIGXFSZ);
> > +	TEST(sigprocmask(SIG_BLOCK, &sigset, NULL));
> > +	if (TEST_RETURN != 0)
> > +		tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
> >   }
> >   
> >   void truncate_verify(struct test_case_t *tc)
> 
> 

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
  2015-01-16  9:26   ` Jan Stancek
@ 2015-01-16  9:33     ` Shuang Qiu
  0 siblings, 0 replies; 5+ messages in thread
From: Shuang Qiu @ 2015-01-16  9:33 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

On 01/16/2015 05:26 PM, Jan Stancek wrote:
>
>
> ----- Original Message -----
>> From: "Shuang Qiu" <shuang.qiu@oracle.com>
>> To: ltp-list@lists.sourceforge.net
>> Cc: "Jan Stancek" <jstancek@redhat.com>
>> Sent: Wednesday, 14 January, 2015 10:15:20 AM
>> Subject: Re: [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test
>>
>> Hello,
>> I find that EFBIG test will fail over nfs filesystem because
>> unexpectedly succeed too.
>> It can catch SIGXFSZ signal but will not fail with EFBIG after blocked
>> SIGXFSZ.
>> I'm not sure if it is expected behavior for truncate against nfs filesystem.
>> Could anyone help to check?
> I'm guessing a bug. write(2) on nfs respects RLIMIT_FSIZE, but truncate(2) does not.
> I think best would be to check with some nfs people: linux-nfs@vger.kernel.org
Thanks Jan.
I will check with the nfs guys.

Thanks
Shuang
>
> Regards,
> Jan
>
>> Thanks
>> Shuang
>> On 08/20/2014 05:42 PM, Jan Stancek wrote:
>>> Using LLONG_MAX as maximum can fail on XFS, because here the maximum
>>> file size is 2^63-1, so this test may unexpectedly succeed.
>>>
>>> Impose limit via setrlimit(RLIMIT_FSIZE,..) and set value used
>>> in EFBIG test to be twice that much.
>>>
>>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
>>> ---
>>>    testcases/kernel/syscalls/truncate/truncate03.c |   18 +++++++++++++++++-
>>>    1 files changed, 17 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/testcases/kernel/syscalls/truncate/truncate03.c
>>> b/testcases/kernel/syscalls/truncate/truncate03.c
>>> index ed5073d..54b7d3c 100644
>>> --- a/testcases/kernel/syscalls/truncate/truncate03.c
>>> +++ b/testcases/kernel/syscalls/truncate/truncate03.c
>>> @@ -50,6 +50,7 @@
>>>    #include <string.h>
>>>    #include <signal.h>
>>>    #include <pwd.h>
>>> +#include <sys/resource.h>
>>>    
>>>    #include "test.h"
>>>    #include "usctest.h"
>>> @@ -65,6 +66,7 @@
>>>    #define NEW_MODE	S_IRUSR | S_IRGRP | S_IROTH
>>>    #define DIR_MODE	S_IRWXU
>>>    #define TRUNC_LEN	256
>>> +#define MAX_FSIZE	(16*1024*1024)
>>>    
>>>    static char long_pathname[PATH_MAX + 2];
>>>    
>>> @@ -82,7 +84,7 @@ static struct test_case_t {
>>>    	{ long_pathname, TRUNC_LEN, ENAMETOOLONG },
>>>    	{ "", TRUNC_LEN, ENOENT },
>>>    	{ TEST_DIR1, TRUNC_LEN, EISDIR },
>>> -	{ TEST_FILE3, LLONG_MAX, EFBIG },
>>> +	{ TEST_FILE3, MAX_FSIZE*2, EFBIG },
>>>    	{ TEST_SYM1, TRUNC_LEN, ELOOP }
>>>    };
>>>    
>>> @@ -124,6 +126,8 @@ void setup(void)
>>>    {
>>>    	struct passwd *ltpuser;
>>>    	char *bad_addr;
>>> +	struct rlimit rlim;
>>> +	sigset_t sigset;
>>>    
>>>    	tst_sig(NOFORK, DEF_HANDLER, cleanup);
>>>    
>>> @@ -156,6 +160,18 @@ void setup(void)
>>>    
>>>    	SAFE_SYMLINK(cleanup, TEST_SYM1, TEST_SYM2);
>>>    	SAFE_SYMLINK(cleanup, TEST_SYM2, TEST_SYM1);
>>> +
>>> +	rlim.rlim_cur = MAX_FSIZE;
>>> +	rlim.rlim_max = MAX_FSIZE;
>>> +	TEST(setrlimit(RLIMIT_FSIZE, &rlim));
>>> +	if (TEST_RETURN != 0)
>>> +		tst_brkm(TBROK | TTERRNO, cleanup, "setrlimit");
>>> +
>>> +	sigemptyset(&sigset);
>>> +	sigaddset(&sigset, SIGXFSZ);
>>> +	TEST(sigprocmask(SIG_BLOCK, &sigset, NULL));
>>> +	if (TEST_RETURN != 0)
>>> +		tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
>>>    }
>>>    
>>>    void truncate_verify(struct test_case_t *tc)
>>


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-01-16 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20  9:42 [LTP] [PATCH] truncate03: impose max file size limit for EFBIG test Jan Stancek
2014-08-20 13:14 ` chrubis
2015-01-14  9:15 ` Shuang Qiu
2015-01-16  9:26   ` Jan Stancek
2015-01-16  9:33     ` Shuang Qiu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.