[LU-525] llapi_file_get_stripe() fails with ENAMETOOLONG Created: 21/Jul/11  Updated: 14/Jul/14  Resolved: 11/Oct/11

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 1.8.6
Fix Version/s: Lustre 1.8.7

Type: Bug Priority: Minor
Reporter: Johann Lombardi (Inactive) Assignee: Johann Lombardi (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Bugzilla ID: 22,766
Rank (Obsolete): 6578

 Description   

The patch from bugzilla ticket 22766 added the following code:

diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c
index 1e88a51..72818c8 100644
--- a/lustre/utils/liblustreapi.c
+++ b/lustre/utils/liblustreapi.c
@@ -1566,6 +1566,8 @@ int llapi_file_get_stripe(const char *path, struct lov_user_md *lum)
         int fd, rc = 0;
 
         fname = strrchr(path, '/');
+        if (strlen(fname) + 1 < sizeof(struct lov_user_md))
+                return ENAMETOOLONG;

This check does not make any sense and causes llapi_file_get_stripe() to fail with ENAMETOOLONG without any obvious reasons.



 Comments   
Comment by Johann Lombardi (Inactive) [ 21/Jul/11 ]

http://review.whamcloud.com/1131

Comment by Andreas Dilger [ 21/Jul/11 ]

Seems that I pointed this out during inspection, but it was landed anyway:

https://bugzilla.lustre.org/show_bug.cgi?id=22766#c39

I agree that check makes no sense and should be removed. Strange that it wasn't reported before.

Comment by Johann Lombardi (Inactive) [ 21/Jul/11 ]

Patch landed.

Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » i686,client,el6,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,client,el6,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,server,el5,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,client,el5,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,client,el5,ofa #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,client,ubuntu1004,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » i686,client,el5,ofa #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » x86_64,server,el5,ofa #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » i686,client,el5,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » i686,server,el5,inkernel #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Build Master (Inactive) [ 21/Jul/11 ]

Integrated in lustre-b1_8 » i686,server,el5,ofa #112
LU-525 llapi_file_get_stripe() fails with ENAMETOOLONG

Johann Lombardi : ad42deebdd27991cb3dc58f0656921b39133bf46
Files :

  • lustre/utils/liblustreapi.c
Comment by Ryan Haasken [ 14/Jul/14 ]

Obviously the check which was removed by http://review.whamcloud.com/1131 is bogus. However, I'm wondering why we don't need to worry about overflow when fname is copied into lum in llapi_file_get_stripe().

        strcpy((char *)lum, fname);

Is it just assumed that the caller of llapi_file_get_stripe() will ensure that lum is big enough to hold the last component of path?

Generated at Sat Feb 10 01:07:54 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.