As Shuang Qiu <[email protected]> reports:
* The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
* Since the pathconf interface is signed, we use 2^31 - 1 instead.
* The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
#define XFS_MAXLINK             ((1U << 31) - 1U)
#define XFS_MAXLINK_1           65535U
We are not able to reach such limitation.

If it cant't reach the max links, return TCONF in the EMLINK test.

Signed-off-by: Zeng Linggang <[email protected]>
---
 testcases/kernel/syscalls/linkat/linkat02.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/linkat/linkat02.c 
b/testcases/kernel/syscalls/linkat/linkat02.c
index 26a244c..21119a5 100644
--- a/testcases/kernel/syscalls/linkat/linkat02.c
+++ b/testcases/kernel/syscalls/linkat/linkat02.c
@@ -54,6 +54,7 @@ static char nametoolong[PATH_MAX+2];
 static char *fstype = "ext2";
 static char *device;
 static int mount_flag;
+static int emlink_flag;
 
 static void setup(void);
 static void cleanup(void);
@@ -127,8 +128,15 @@ int main(int ac, char **av)
 
 static void linkat_verify(const struct test_struct *desc)
 {
-       if (desc->setupfunc != NULL)
-               desc->setupfunc();
+       if (desc->setupfunc != NULL) {
+               if (desc->setupfunc == setup_emlink && emlink_flag == 1) {
+                       tst_resm(TCONF, "We can't reach the max links for %s",
+                                fstype);
+                       return;
+               } else {
+                       desc->setupfunc();
+               }
+       }
 
        TEST(ltp_syscall(__NR_linkat, AT_FDCWD, desc->oldfname,
                         AT_FDCWD, desc->newfname, desc->flags));
@@ -204,8 +212,10 @@ static void setup(void)
                                         fstype, link_max);
                                break;
                        default:
-                               tst_brkm(TBROK | TTERRNO, cleanup,
-                                        "Unexpected error: ");
+                               emlink_flag = 1;
+                               tst_resm(TINFO | TTERRNO,
+                                        "for %s we can't reach the max links",
+                                        fstype);
                                break;
                        }
                        break;
-- 
1.8.4.2




------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to