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

several llapi functions use opendir() when open() would suffice

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.10.0
    • Lustre 2.9.0
    • 3
    • 9223372036854775807

    Description

      llapi_get_obd_count(), llapi_ostlist(), llapi_quotactl(), llapi_get_connect_flags(), and possibly other llapi functions are using opendir(), dirfd(), and closedir() when open() and close() would suffice.

      Attachments

        Activity

          [LU-8724] several llapi functions use opendir() when open() would suffice
          pjones Peter Jones added a comment -

          Landed for 2.10

          pjones Peter Jones added a comment - Landed for 2.10

          Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/23981/
          Subject: LU-8724 utils: Use open() instead of opendir() with dirfd()
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: 44b6af40f70cf065e8198b6b438d6c953063d003

          gerrit Gerrit Updater added a comment - Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/23981/ Subject: LU-8724 utils: Use open() instead of opendir() with dirfd() Project: fs/lustre-release Branch: master Current Patch Set: Commit: 44b6af40f70cf065e8198b6b438d6c953063d003

          OK. setup_obd_uuid() is called elsewhere, so I'll have to update the other code that will be impacted. I'll upload a new patch when those changes are made.

          sguminsx Steve Guminski (Inactive) added a comment - OK. setup_obd_uuid() is called elsewhere, so I'll have to update the other code that will be impacted. I'll upload a new patch when those changes are made.
          jhammond John Hammond added a comment -

          James, please open a new issue.

          jhammond John Hammond added a comment - James, please open a new issue.
          jhammond John Hammond added a comment -

          > I don't think llapi_ostlist() should be changed, because it uses the opened directory as a parameter to setup_obd_uuid(), which takes a DIR pointer.

          setup_obd_uuid() only uses the dir parameter as an argument to dirfd(). So its DIR *dir parameter should be replaced with int fd.

          jhammond John Hammond added a comment - > I don't think llapi_ostlist() should be changed, because it uses the opened directory as a parameter to setup_obd_uuid(), which takes a DIR pointer. setup_obd_uuid() only uses the dir parameter as an argument to dirfd(). So its DIR *dir parameter should be replaced with int fd .
          simmonsja James A Simmons added a comment - - edited

          While you are at it another issue exist as well with newer platforms. On my Ubuntu 16 system I get the following build issues:

          gcc -DHAVE_CONFIG_H -I. -I../.. -include /usr/src/lustre-2.8.60/undef.h -include /usr/src/lustre-2.8.60/config.h -I/usr/src/lustre-2.8.60/libcfs/include -I/usr/src/lustre-2.8.60/lnet/include -I/usr/src/lustre-2.8.60/lustre/include -fPIC -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLUSTRE_UTILS=1 -g -O2 -Wall -Werror -MT liblustreapi.o -MD -MP -MF .deps/liblustreapi.Tpo -c -o liblustreapi.o liblustreapi.c
          liblustreapi.c: In function ‘llapi_get_poollist’:
          liblustreapi.c:1196:3: error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations]
          rc = readdir_r(dir, &pool, &cookie);
          ^~
          In file included from /usr/include/features.h:364:0,
          from /usr/include/mntent.h:22,
          from liblustreapi.c:44:
          /usr/include/dirent.h:189:12: note: declared here
          extern int __REDIRECT (readdir_r,
          ^
          cc1: all warnings being treated as errors
          Makefile:1191: recipe for target 'liblustreapi.o' failed

          readdir() is the replacement for this function,

          simmonsja James A Simmons added a comment - - edited While you are at it another issue exist as well with newer platforms. On my Ubuntu 16 system I get the following build issues: gcc -DHAVE_CONFIG_H -I. -I../.. -include /usr/src/lustre-2.8.60/undef.h -include /usr/src/lustre-2.8.60/config.h -I/usr/src/lustre-2.8.60/libcfs/include -I/usr/src/lustre-2.8.60/lnet/include -I/usr/src/lustre-2.8.60/lustre/include -fPIC -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DLUSTRE_UTILS=1 -g -O2 -Wall -Werror -MT liblustreapi.o -MD -MP -MF .deps/liblustreapi.Tpo -c -o liblustreapi.o liblustreapi.c liblustreapi.c: In function ‘llapi_get_poollist’: liblustreapi.c:1196:3: error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations] rc = readdir_r(dir, &pool, &cookie); ^~ In file included from /usr/include/features.h:364:0, from /usr/include/mntent.h:22, from liblustreapi.c:44: /usr/include/dirent.h:189:12: note: declared here extern int __REDIRECT (readdir_r, ^ cc1: all warnings being treated as errors Makefile:1191: recipe for target 'liblustreapi.o' failed readdir() is the replacement for this function,

          Steve Guminski (stephenx.guminski@intel.com) uploaded a new patch: http://review.whamcloud.com/23981
          Subject: LU-8724 utils: Use open() instead of opendir() with dirfd()
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: f57b28954e8fff0467e3d7877c003c62cefe768f

          gerrit Gerrit Updater added a comment - Steve Guminski (stephenx.guminski@intel.com) uploaded a new patch: http://review.whamcloud.com/23981 Subject: LU-8724 utils: Use open() instead of opendir() with dirfd() Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: f57b28954e8fff0467e3d7877c003c62cefe768f

          I don't think llapi_ostlist() should be changed, because it uses the opened directory as a parameter to setup_obd_uuid(), which takes a DIR pointer.

          sguminsx Steve Guminski (Inactive) added a comment - I don't think llapi_ostlist() should be changed, because it uses the opened directory as a parameter to setup_obd_uuid(), which takes a DIR pointer.

          People

            sguminsx Steve Guminski (Inactive)
            jhammond John Hammond
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: