Hi, This is all probably perfectly clear to someone with the GPFS source code but … we’re looking at writing some code using the API documented at: https://www.ibm.com/support/knowledgecenter/STXKQY_5.0.1/com.ibm.spectrum.sc... Specifically gpfs_getacl() function, in the docs you pass acl, and the notes say “Pointer to a buffer mapped by the structure gpfs_opaque_acl_t or gpfs_acl_t, depending on the value of flags. The first four bytes of the buffer must contain its total size.”. Reading the docs for gpfs_opaque_acl_t, this is a struct of which the first element is an int. Is this the same 4 bytes referred to as above containing the size, and is this the size of the struct, of of the acl_var_data entry? It strikes me is should probably be the length of acl_var_data, but it is not entirely clear? Thanks Simon
Look in gps.h.... I think the comment for acl_buffer_len is clear enough! /* Mapping of buffer for gpfs_getacl, gpfs_putacl. */ typedef struct gpfs_opaque_acl { int acl_buffer_len; /* INPUT: Total size of buffer (including this field). OUTPUT: Actual size of the ACL information. */ unsigned short acl_version; /* INPUT: Set to zero. OUTPUT: Current version of the returned ACL. */ unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */ char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */ } gpfs_opaque_acl_t; From: Simon Thompson <S.J.Thompson@bham.ac.uk> To: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Date: 12/17/2018 10:13 AM Subject: [gpfsug-discuss] GPFS API Sent by: gpfsug-discuss-bounces@spectrumscale.org Hi, This is all probably perfectly clear to someone with the GPFS source code but … we’re looking at writing some code using the API documented at: https://www.ibm.com/support/knowledgecenter/STXKQY_5.0.1/com.ibm.spectrum.sc... Specifically gpfs_getacl() function, in the docs you pass acl, and the notes say “Pointer to a buffer mapped by the structure gpfs_opaque_acl_t or gpfs_acl_t, depending on the value of flags. The first four bytes of the buffer must contain its total size.”. Reading the docs for gpfs_opaque_acl_t, this is a struct of which the first element is an int. Is this the same 4 bytes referred to as above containing the size, and is this the size of the struct, of of the acl_var_data entry? It strikes me is should probably be the length of acl_var_data, but it is not entirely clear? Thanks Simon _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
On Mon, 2018-12-17 at 10:47 -0500, Marc A Kaplan wrote:
Look in gps.h.... I think the comment for acl_buffer_len is clear enough!
I guess everyone does not read header files by default looking for comments on the structure ;-) One thing to watch out for is to check the return from gpfs_getacl, and if you get an ENOSPC error then your buffer is not big enough to hold the ACL and the first four bytes are set to the size you need. SO you need to do something like the following to safely get the ACL. acl = malloc(1024); acl->acl_len = 1024; acl->acl_level = 0; acl->acl_version = 0; acl->acl_type = 0; acl->acl_nace = 0; err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl); if ((err==-1) && (errno=ENOSPC)) { int acl_size = acl->acl_len; free(acl); acl = malloc(acl_size); acl->acl_len = acl_size; acl->acl_level = 0; acl->acl_version = 0; acl->acl_type = 0; acl->acl_nace = 0; err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl); } Noting that unless you have some monster ACL 1KB is going to be more than enough. It is less than 16 bytes per ACL. What is not clear is the following in the gpfs_acl struct. v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */ What's that about, because there is zero documentation on it. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
Indeed. Actually this was exactly what we were trying to work out. We'd set the buf size to 0 hoping it would tell us how much we need, but we kept getting EINVAL back - which the docs states is invalid path, but actually it can be invalid bufsize as well apparently (the header file comments are different again to the docs). Anyway, we're looking at patching mpifileutils to support GPFS ACLs to help with migration of between old and new file-systems. I was actually using the opaque call on the assumption that it would be a binary blob of data I could poke to the new file. (I was too scared to use the attr functions as that copies DMAPI info as well and I'm not sure I want to "copy" my ILM files without recall!). Its not clear what DEFAULT and ACCESS ACLs are. I'm guessing something to do with inheritance maybe? Thanks Marc, Jonathan for the pointers! Simon ________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org [gpfsug-discuss-bounces@spectrumscale.org] on behalf of Jonathan Buzzard [jonathan.buzzard@strath.ac.uk] Sent: 17 December 2018 16:46 To: gpfsug main discussion list Subject: Re: [gpfsug-discuss] GPFS API On Mon, 2018-12-17 at 10:47 -0500, Marc A Kaplan wrote:
Look in gps.h.... I think the comment for acl_buffer_len is clear enough!
I guess everyone does not read header files by default looking for comments on the structure ;-) One thing to watch out for is to check the return from gpfs_getacl, and if you get an ENOSPC error then your buffer is not big enough to hold the ACL and the first four bytes are set to the size you need. SO you need to do something like the following to safely get the ACL. acl = malloc(1024); acl->acl_len = 1024; acl->acl_level = 0; acl->acl_version = 0; acl->acl_type = 0; acl->acl_nace = 0; err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl); if ((err==-1) && (errno=ENOSPC)) { int acl_size = acl->acl_len; free(acl); acl = malloc(acl_size); acl->acl_len = acl_size; acl->acl_level = 0; acl->acl_version = 0; acl->acl_type = 0; acl->acl_nace = 0; err = gpfs_getacl(fpath, GPFS_GETACL_STRUCT, acl); } Noting that unless you have some monster ACL 1KB is going to be more than enough. It is less than 16 bytes per ACL. What is not clear is the following in the gpfs_acl struct. v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */ What's that about, because there is zero documentation on it. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
On 17/12/2018 17:35, Simon Thompson wrote:
Indeed.
Actually this was exactly what we were trying to work out. We'd set the buf size to 0 hoping it would tell us how much we need, but we kept getting EINVAL back - which the docs states is invalid path, but actually it can be invalid bufsize as well apparently (the header file comments are different again to the docs).
Well duh, if you pass in a zero sized buffer, then there is no space to pass the size back because it's in the first four bytes of the returned buffer. Further it needs to be big enough to hold the main fields otherwise did you request POSIX or NFSv4 ACL's etc.
Anyway, we're looking at patching mpifileutils to support GPFS ACLs to help wi th migration of between old and new file-systems.
I was actually using the opaque call on the assumption that it would be a binary blob of data I could poke to the new file. (I was too scared to use the attr functions as that copies DMAPI info as well and I'm not sure I want to "copy" my ILM files without recall!).
Its not clear what DEFAULT and ACCESS ACLs are. I'm guessing something to do with inheritance maybe?
A default ACL is the default ACL that would be given to the file. Access ACL's are all the other ones. That is pretty basic ACL stuff. I would really like some info on the v4Level1_t stuff, as I ma reluctant to release my mmsetfacl code until I do. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
No, it comes back as the first four bytes of the structure in the size field. So if we set it the data field to zero, then it still has space in the size filed to return the required size. That was sort of the point.... The size value needs to be the size of the struct rather than the data field within it. Simon ________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org [gpfsug-discuss-bounces@spectrumscale.org] on behalf of Jonathan Buzzard [jonathan.buzzard@strath.ac.uk] Sent: 17 December 2018 22:44 To: gpfsug-discuss@spectrumscale.org Subject: Re: [gpfsug-discuss] GPFS API On 17/12/2018 17:35, Simon Thompson wrote:
Indeed.
Actually this was exactly what we were trying to work out. We'd set the buf size to 0 hoping it would tell us how much we need, but we kept getting EINVAL back - which the docs states is invalid path, but actually it can be invalid bufsize as well apparently (the header file comments are different again to the docs).
Well duh, if you pass in a zero sized buffer, then there is no space to pass the size back because it's in the first four bytes of the returned buffer. Further it needs to be big enough to hold the main fields otherwise did you request POSIX or NFSv4 ACL's etc.
Anyway, we're looking at patching mpifileutils to support GPFS ACLs to help wi th migration of between old and new file-systems.
I was actually using the opaque call on the assumption that it would be a binary blob of data I could poke to the new file. (I was too scared to use the attr functions as that copies DMAPI info as well and I'm not sure I want to "copy" my ILM files without recall!).
Its not clear what DEFAULT and ACCESS ACLs are. I'm guessing something to do with inheritance maybe?
A default ACL is the default ACL that would be given to the file. Access ACL's are all the other ones. That is pretty basic ACL stuff. I would really like some info on the v4Level1_t stuff, as I ma reluctant to release my mmsetfacl code until I do. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
On 17/12/2018 17:35, Simon Thompson wrote:
Indeed.
Actually this was exactly what we were trying to work out. We'd set the buf size to 0 hoping it would tell us how much we need, but we kept getting EINVAL back - which the docs states is invalid path, but actually it can be invalid bufsize as well apparently (the header file comments are different again to the docs).
Forgot to say performance wise calling with effectively a zero buffer size and then calling again with precisely the right buffer size is not sensible plan. Basically you end up having to do two API calls instead of one to save less than 1KB of RAM in 99.999% of cases. Let's face it any machine running GPFS is going to have GB of RAM. That said I am not sure even allocating 1KB of RAM is sensible either. One suspects allocating less than a whole page might have performance implications. What I do know from testing is that, two API calls when iterating over millions of files has a significant impact on run time over just allocating a bunch of memory up front on only making the one call. JAB. -- Jonathan A. Buzzard Tel: +44141-5483420 HPC System Administrator, ARCHIE-WeSt. University of Strathclyde, John Anderson Building, Glasgow. G4 0NG
participants (3)
-
Jonathan Buzzard -
Marc A Kaplan -
Simon Thompson
