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
            pjones Peter Jones added a comment -

            Merged for 2.16

            pjones Peter Jones added a comment - Merged for 2.16

            "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

            People

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

              Dates

                Created:
                Updated:
                Resolved: