* [LTP] [PATCH] dup07:Close the file before unlink it.
@ 2013-05-24 3:03 shuang.qiu
2013-05-24 6:47 ` Jan Stancek
2013-05-24 7:00 ` Wanlong Gao
0 siblings, 2 replies; 6+ messages in thread
From: shuang.qiu @ 2013-05-24 3:03 UTC (permalink / raw)
To: ltp-list
From: Shuang Qiu <shuang.qiu@oracle.com>
When unlink() a file in nfs environment,it will rename the file to a
.nfs<xxxxx> file if any process still has that file open.And this file
could not be deleted until it is closed.So we always get the following
warning which makes testcase "dup07" failed:
0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
failed:
unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
failed; errno=16: Device or resource busy
Close the created/dup file before unlink() it to fix this issue.
Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
testcases/kernel/syscalls/dup/dup07.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/testcases/kernel/syscalls/dup/dup07.c b/testcases/kernel/syscalls/dup/dup07.c
index 03b0ba4..025881f 100644
--- a/testcases/kernel/syscalls/dup/dup07.c
+++ b/testcases/kernel/syscalls/dup/dup07.c
@@ -77,7 +77,9 @@ int main(int ac, char **av)
tst_resm(TPASS,
"Passed in read mode.");
}
+ close(duprdo);
}
+ close(rdoret);
}
unlink(testfile);
@@ -97,7 +99,10 @@ int main(int ac, char **av)
tst_resm(TPASS,
"Passed in write mode.");
}
+ close(dupwro);
}
+ close(wroret);
+
}
unlink(testfile);
@@ -117,7 +122,9 @@ int main(int ac, char **av)
tst_resm(TPASS,
"Passed in read/write mode.");
}
+ close(duprdwr);
}
+ close(rdwret);
}
unlink(testfile);
--
1.7.7
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] dup07:Close the file before unlink it.
2013-05-24 3:03 [LTP] [PATCH] dup07:Close the file before unlink it shuang.qiu
@ 2013-05-24 6:47 ` Jan Stancek
2013-05-24 7:00 ` Wanlong Gao
1 sibling, 0 replies; 6+ messages in thread
From: Jan Stancek @ 2013-05-24 6:47 UTC (permalink / raw)
To: shuang qiu; +Cc: ltp-list
----- Original Message -----
> From: "shuang qiu" <shuang.qiu@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Friday, 24 May, 2013 5:03:39 AM
> Subject: [LTP] [PATCH] dup07:Close the file before unlink it.
>
> From: Shuang Qiu <shuang.qiu@oracle.com>
>
> When unlink() a file in nfs environment,it will rename the file to a
> .nfs<xxxxx> file if any process still has that file open.And this file
> could not be deleted until it is closed.So we always get the following
> warning which makes testcase "dup07" failed:
> 0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
> failed:
> unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
> failed; errno=16: Device or resource busy
>
> Close the created/dup file before unlink() it to fix this issue.
>
> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Looks good, ran fine for me with TMPDIR on nfsv3.
Reviewed-by: Jan Stancek <jstancek@redhat.com>
> ---
> testcases/kernel/syscalls/dup/dup07.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/dup/dup07.c
> b/testcases/kernel/syscalls/dup/dup07.c
> index 03b0ba4..025881f 100644
> --- a/testcases/kernel/syscalls/dup/dup07.c
> +++ b/testcases/kernel/syscalls/dup/dup07.c
> @@ -77,7 +77,9 @@ int main(int ac, char **av)
> tst_resm(TPASS,
> "Passed in read mode.");
> }
> + close(duprdo);
> }
> + close(rdoret);
> }
>
> unlink(testfile);
> @@ -97,7 +99,10 @@ int main(int ac, char **av)
> tst_resm(TPASS,
> "Passed in write mode.");
> }
> + close(dupwro);
> }
> + close(wroret);
> +
> }
>
> unlink(testfile);
> @@ -117,7 +122,9 @@ int main(int ac, char **av)
> tst_resm(TPASS,
> "Passed in read/write mode.");
> }
> + close(duprdwr);
> }
> + close(rdwret);
> }
>
> unlink(testfile);
> --
> 1.7.7
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH] dup07:Close the file before unlink it.
2013-05-24 3:03 [LTP] [PATCH] dup07:Close the file before unlink it shuang.qiu
2013-05-24 6:47 ` Jan Stancek
@ 2013-05-24 7:00 ` Wanlong Gao
1 sibling, 0 replies; 6+ messages in thread
From: Wanlong Gao @ 2013-05-24 7:00 UTC (permalink / raw)
To: shuang.qiu; +Cc: ltp-list
On 05/24/2013 11:03 AM, shuang.qiu@oracle.com wrote:
> From: Shuang Qiu <shuang.qiu@oracle.com>
>
> When unlink() a file in nfs environment,it will rename the file to a
> .nfs<xxxxx> file if any process still has that file open.And this file
> could not be deleted until it is closed.So we always get the following
> warning which makes testcase "dup07" failed:
> 0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
> failed:
> unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
> failed; errno=16: Device or resource busy
>
> Close the created/dup file before unlink() it to fix this issue.
>
> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH] dup07:Close the file before unlink it.
@ 2013-05-23 7:09 shuang.qiu
2013-05-23 8:07 ` Jan Stancek
0 siblings, 1 reply; 6+ messages in thread
From: shuang.qiu @ 2013-05-23 7:09 UTC (permalink / raw)
To: ltp-list
From: Shuang Qiu <shuang.qiu@oracle.com>
When unlink() a file in nfs environment,it will rename the file to a
.nfs<xxxxx> file if any process still has that file open.And this file
could not be deleted until it is closed.So we always get the following
warning which makes testcase "dup07" failed:
0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
failed:
unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
failed; errno=16: Device or resource busy
Close the created/dup file before unlink() it to fix this issue.
Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
testcases/kernel/syscalls/dup/dup07.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/testcases/kernel/syscalls/dup/dup07.c b/testcases/kernel/syscalls/dup/dup07.c
index 03b0ba4..19cd751 100644
--- a/testcases/kernel/syscalls/dup/dup07.c
+++ b/testcases/kernel/syscalls/dup/dup07.c
@@ -80,6 +80,10 @@ int main(int ac, char **av)
}
}
+ if (duprdo != -1)
+ close(duprdo);
+ if (rdoret != -1)
+ close(rdoret);
unlink(testfile);
if ((wroret = creat(testfile, 0222)) == -1) {
@@ -100,6 +104,10 @@ int main(int ac, char **av)
}
}
+ if (dupwro != -1)
+ close(dupwro);
+ if (wroret != -1)
+ close(wroret);
unlink(testfile);
if ((rdwret = creat(testfile, 0666)) == -1) {
@@ -120,6 +128,10 @@ int main(int ac, char **av)
}
}
+ if (duprdwr != -1)
+ close(duprdwr);
+ if (rdwret != -1)
+ close(rdwret);
unlink(testfile);
}
--
1.7.7
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [LTP] [PATCH] dup07:Close the file before unlink it.
2013-05-23 7:09 shuang.qiu
@ 2013-05-23 8:07 ` Jan Stancek
2013-05-24 3:02 ` Shuang Qiu
0 siblings, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2013-05-23 8:07 UTC (permalink / raw)
To: shuang qiu; +Cc: ltp-list
----- Original Message -----
> From: "shuang qiu" <shuang.qiu@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 23 May, 2013 9:09:07 AM
> Subject: [LTP] [PATCH] dup07:Close the file before unlink it.
>
> From: Shuang Qiu <shuang.qiu@oracle.com>
>
> When unlink() a file in nfs environment,it will rename the file to a
> .nfs<xxxxx> file if any process still has that file open.And this file
> could not be deleted until it is closed.So we always get the following
> warning which makes testcase "dup07" failed:
> 0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
> failed:
> unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
> failed; errno=16: Device or resource busy
>
> Close the created/dup file before unlink() it to fix this issue.
>
> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
Hi,
this is introducing some warnings:
dup07.c:53: warning: ‘duprdo’ may be used uninitialized in this function
dup07.c:53: warning: ‘dupwro’ may be used uninitialized in this function
dup07.c:53: warning: ‘duprdwr’ may be used uninitialized in this function
Rather than initializing these to -1, I'd suggest to move those close() calls
to else branches:
@@ -77,7 +77,9 @@ int main(int ac, char **av)
tst_resm(TPASS,
"Passed in read mode.");
}
+ close(duprdo);
}
+ close(rdoret);
}
Regards,
Jan
> ---
> testcases/kernel/syscalls/dup/dup07.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/dup/dup07.c
> b/testcases/kernel/syscalls/dup/dup07.c
> index 03b0ba4..19cd751 100644
> --- a/testcases/kernel/syscalls/dup/dup07.c
> +++ b/testcases/kernel/syscalls/dup/dup07.c
> @@ -80,6 +80,10 @@ int main(int ac, char **av)
> }
> }
>
> + if (duprdo != -1)
> + close(duprdo);
> + if (rdoret != -1)
> + close(rdoret);
> unlink(testfile);
>
> if ((wroret = creat(testfile, 0222)) == -1) {
> @@ -100,6 +104,10 @@ int main(int ac, char **av)
> }
> }
>
> + if (dupwro != -1)
> + close(dupwro);
> + if (wroret != -1)
> + close(wroret);
> unlink(testfile);
>
> if ((rdwret = creat(testfile, 0666)) == -1) {
> @@ -120,6 +128,10 @@ int main(int ac, char **av)
> }
> }
>
> + if (duprdwr != -1)
> + close(duprdwr);
> + if (rdwret != -1)
> + close(rdwret);
> unlink(testfile);
> }
>
> --
> 1.7.7
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [LTP] [PATCH] dup07:Close the file before unlink it.
2013-05-23 8:07 ` Jan Stancek
@ 2013-05-24 3:02 ` Shuang Qiu
0 siblings, 0 replies; 6+ messages in thread
From: Shuang Qiu @ 2013-05-24 3:02 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 05/23/2013 04:07 PM, Jan Stancek wrote:
> ----- Original Message -----
>> From: "shuang qiu" <shuang.qiu@oracle.com>
>> To: ltp-list@lists.sourceforge.net
>> Sent: Thursday, 23 May, 2013 9:09:07 AM
>> Subject: [LTP] [PATCH] dup07:Close the file before unlink it.
>>
>> From: Shuang Qiu <shuang.qiu@oracle.com>
>>
>> When unlink() a file in nfs environment,it will rename the file to a
>> .nfs<xxxxx> file if any process still has that file open.And this file
>> could not be deleted until it is closed.So we always get the following
>> warning which makes testcase "dup07" failed:
>> 0 TWARN : tst_rmdir: rmobj(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H)
>> failed:
>> unlink(/mnt/nfsv3/ltp-ZtzSE27611/dupKuEr3H/.nfs000000000110cb3800000066)
>> failed; errno=16: Device or resource busy
>>
>> Close the created/dup file before unlink() it to fix this issue.
>>
>> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
> Hi,
>
> this is introducing some warnings:
> dup07.c:53: warning: ‘duprdo’ may be used uninitialized in this function
> dup07.c:53: warning: ‘dupwro’ may be used uninitialized in this function
> dup07.c:53: warning: ‘duprdwr’ may be used uninitialized in this function
>
> Rather than initializing these to -1, I'd suggest to move those close() calls
> to else branches:
> @@ -77,7 +77,9 @@ int main(int ac, char **av)
> tst_resm(TPASS,
> "Passed in read mode.");
> }
> + close(duprdo);
> }
> + close(rdoret);
> }
Agree,will update the patch.
Thanks
Shuang
> Regards,
> Jan
>
>> ---
>> testcases/kernel/syscalls/dup/dup07.c | 12 ++++++++++++
>> 1 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/dup/dup07.c
>> b/testcases/kernel/syscalls/dup/dup07.c
>> index 03b0ba4..19cd751 100644
>> --- a/testcases/kernel/syscalls/dup/dup07.c
>> +++ b/testcases/kernel/syscalls/dup/dup07.c
>> @@ -80,6 +80,10 @@ int main(int ac, char **av)
>> }
>> }
>>
>> + if (duprdo != -1)
>> + close(duprdo);
>> + if (rdoret != -1)
>> + close(rdoret);
>> unlink(testfile);
>>
>> if ((wroret = creat(testfile, 0222)) == -1) {
>> @@ -100,6 +104,10 @@ int main(int ac, char **av)
>> }
>> }
>>
>> + if (dupwro != -1)
>> + close(dupwro);
>> + if (wroret != -1)
>> + close(wroret);
>> unlink(testfile);
>>
>> if ((rdwret = creat(testfile, 0666)) == -1) {
>> @@ -120,6 +128,10 @@ int main(int ac, char **av)
>> }
>> }
>>
>> + if (duprdwr != -1)
>> + close(duprdwr);
>> + if (rdwret != -1)
>> + close(rdwret);
>> unlink(testfile);
>> }
>>
>> --
>> 1.7.7
>>
>>
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-24 7:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24 3:03 [LTP] [PATCH] dup07:Close the file before unlink it shuang.qiu
2013-05-24 6:47 ` Jan Stancek
2013-05-24 7:00 ` Wanlong Gao
-- strict thread matches above, loose matches on Subject: below --
2013-05-23 7:09 shuang.qiu
2013-05-23 8:07 ` Jan Stancek
2013-05-24 3:02 ` Shuang Qiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox