Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-17025

Invalid pool name does not return error

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Lustre 2.16.0
    • Lustre 2.15.3
    • None

    Description

      Passing invalid striping parameters does not return error. In the below given test case the llapi_file_open_pool did not have right pool name and it did not fail

      Below given is the test case that failed.

      // compile with:
      // cc llapi_noerr.c -llustreapi
      //
      // This program will produce a file ( ./test_file ) with invalid striping (in particular the pool) without raising an error.
      //
      // This can be verified with:
      // lfs getstripe ./test_file 
      #if !defined(_POSIX_C_SOURCE)
      #define _POSIX_C_SOURCE 200809L 
      #endif
      
      #include <stdio.h>
      #include <fcntl.h>
      #include <lustre/lustreapi.h>
      #include <stdlib.h> 
      #include <string.h>
      
      typedef struct {
         int64_t count;
         int64_t size;
         int64_t offset;
         int64_t pattern; 
         char *pool;
      } lustrestripe; 
      
      void f_get_lov_maxpoolname(int64_t *max) {
         *max = LOV_MAXPOOLNAME;
      } 
      
      static bool apply_stripe(lustrestripe *stripe_info, char *filename) {
         const mode_t perm = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; bool success = 0;
         int open_return;
         char *pool; pool = stripe_info->pool;
      
         printf("max poolname size = %i\n",LOV_MAXPOOLNAME); 
         if (pool != NULL) { 
           int64_t pool_max_size;
           f_get_lov_maxpoolname(&pool_max_size);
           if (strnlen(pool, (size_t)pool_max_size) == 0) { 
             pool = NULL; 
           }
         } 
      
         open_return = llapi_file_open_pool(filename, O_CREAT | O_WRONLY, (int)perm, 
                  (unsigned long long)stripe_info->size, (int)stripe_info->offset,
                  (int)stripe_info->count, (int)stripe_info->pattern, pool); 
         printf("open_return = %i\n",open_return);
      
         if (open_return < 0) {
           /* Something went wrong. */
           printf("open: lustreapi_pool: ERROR: %s\n", strerror(-open_return));  
           printf("open: lustreapi_pool: perm: %i\n", (int)perm); 
           printf("open: lustreapi_pool: size: %llu\n", (unsigned long long)stripe_info->size);
           printf("open: lustreapi_pool: offset: %i\n", (int)stripe_info->offset); 
           printf("open: lustreapi_pool: count: %i\n", (int)stripe_info->count); 
           printf("open: lustreapi_pool: pattern: %i\n", (int)stripe_info->pattern);
      
           if (pool == NULL) {
             printf("open: lustreapi_pool: pool: <default>\n"); 
           } else {
             printf("open: lustreapi_pool: pool: '%s'\n", pool); 
           } 
         } else {
           /* Striping information was set. */ 
           close(open_return); 
           success = 1;
           printf("No error from llapi_file_open_pool()\n"); 
         } 
        return success; 
      }
      
      int main() {
       bool res; 
      
       printf("open file with llapi\n");
      
       lustrestripe stripe_parms; 
       stripe_parms.size = 8388608; 
       stripe_parms.offset = -1; 
       stripe_parms.count = 10; 
       stripe_parms.pattern = LOV_PATTERN_RAID0; 
       stripe_parms.pool = calloc(LOV_MAXPOOLNAME,sizeof(char)); snprintf(stripe_parms.pool,LOV_MAXPOOLNAME,"stupidpool"); 
      
       char *filename = "./test_file"; 
       res = apply_stripe(&stripe_parms, filename);
       free(stripe_parms.pool); return (int)res; 
      }
      

       

      Attachments

        Issue Links

          Activity

            [LU-17025] Invalid pool name does not return error

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/54355/
            Subject: LU-17025 llapi: restore 'pool=ignore' functionality
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 61c232554dae25340369e19baa98424e76288a22

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/54355/ Subject: LU-17025 llapi: restore 'pool=ignore' functionality Project: fs/lustre-release Branch: master Current Patch Set: Commit: 61c232554dae25340369e19baa98424e76288a22

            hpebug id added

            rajeevm Rajeev Mishra added a comment - hpebug id added
            rajeevm Rajeev Mishra added a comment - https://review.whamcloud.com/c/fs/lustre-release/+/54355  has the fix for ignore pool

            "Rajeev Mishra <rajeevm@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/54355
            Subject: LU-17025 llapi: ignore pool fixes for lu-17025
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 6b0b0d1b086f82862a8dc2fc0e4491049e1f4d57

            gerrit Gerrit Updater added a comment - "Rajeev Mishra <rajeevm@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/54355 Subject: LU-17025 llapi: ignore pool fixes for lu-17025 Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 6b0b0d1b086f82862a8dc2fc0e4491049e1f4d57

            Andreas will get the concern fix asap. Thanks

            rajeevm Rajeev Mishra added a comment - Andreas will get the concern fix asap. Thanks

            rajeevm to be clear - the issues reported in the revert patch are irrelevant to you.  That patch is just a placeholder so that we don't forget to address this issue one way or another before the 2.16.0 release.

            What you should work on is changing ost-pools test_32 back to using "-p ignore" instead of creating a pool named ignore_pool, and allow that pool name (along with inherit and none) to be passed through to the MDS instead of being rejected by your changes as an invalid pool name.

            adilger Andreas Dilger added a comment - rajeevm to be clear - the issues reported in the revert patch are irrelevant to you.  That patch is just a placeholder so that we don't forget to address this issue one way or another before the 2.16.0 release. What you should work on is changing ost-pools test_32 back to using " -p ignore " instead of creating a pool named ignore_pool , and allow that pool name (along with inherit and none ) to be passed through to the MDS instead of being rejected by your changes as an invalid pool name.

            will work on fixing the issues reported in the revert. 

            https://review.whamcloud.com/c/fs/lustre-release/+/54198

            rajeevm Rajeev Mishra added a comment - will work on fixing the issues reported in the revert.  https://review.whamcloud.com/c/fs/lustre-release/+/54198

            Reopen pending fix.

            adilger Andreas Dilger added a comment - Reopen pending fix.
            gerrit Gerrit Updater added a comment - - edited

            "Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/54198
            Subject: LU-17025 revert "llapi: Verify stripe pool name"
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 4130c275a91e4bf0540a54e84798599c8f47507e

            gerrit Gerrit Updater added a comment - - edited "Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/54198 Subject: LU-17025 revert "llapi: Verify stripe pool name" Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 4130c275a91e4bf0540a54e84798599c8f47507e

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51963/
            Subject: LU-17025 llapi: Verify stripe pool name
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: ee7dfc5ad17d322e2e27ea2629c4a2d8e11a3507

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/51963/ Subject: LU-17025 llapi: Verify stripe pool name Project: fs/lustre-release Branch: master Current Patch Set: Commit: ee7dfc5ad17d322e2e27ea2629c4a2d8e11a3507

            "Rajeev Mishra <rajeevm@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51963
            Subject: LU-17025 llapi: Verify stripe pool name
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: bc0770775c3335661213ae5311bc853b0265e521

            gerrit Gerrit Updater added a comment - "Rajeev Mishra <rajeevm@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/51963 Subject: LU-17025 llapi: Verify stripe pool name Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: bc0770775c3335661213ae5311bc853b0265e521

            People

              rajeevm Rajeev Mishra
              rajeevm Rajeev Mishra
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: