I am trying to run the Code: #include <stdio.h> #include <unistd.h> #include <lustre/liblustreapi.h> #include <sys/types.h> #include <pwd.h> #include <string.h> #include <errno.h> int main(int argc, char *argv[]) { struct if_quotactl qctl; char szpath[FILENAME_MAX]; struct passwd *pw; uid_t uid; gid_t gid; int rc; pw = getpwuid(geteuid()); if (!pw) { fprintf(stderr, "%s: getpwuid on geteuid failed!\n", argv[0]); return -1; } uid = pw->pw_uid; gid = pw->pw_gid; sprintf(szpath, "/n/circelfs"); memset(&qctl, 0, sizeof(qctl)); qctl.qc_cmd = LUSTRE_Q_GETQUOTA; qctl.qc_id = gid; qctl.qc_type = UGQUOTA; rc = llapi_quotactl(szpath, &qctl); if (rc) { fprintf(stderr, "%s: llapi_quotactl %s: %s\n", argv[0], szpath, strerror(errno)); return rc; } struct obd_dqblk *dqb = &qctl.qc_dqblk; printf("Quota for %s on %s: %ld\n", pw->pw_name, szpath, dqb->dqb_bhardlimit*QUOTABLOCK_SIZE); return 0; } Compiled using the Makefile: CC=gcc CFLAGS=-g LIBS=-llustreapi -lm RM=/bin/rm EXECS = rquota OBJS = rquota.o all: $(EXECS) $(EXECS): $(OBJS) Makefile $(CC) $(CFLAGS) -o $(EXECS) $(OBJS) $(LIBS) $(OBJS): Makefile .c.o: $(CC) $(CFLAGS) -o $*.o -c $*.c clean: $(RM) -f $(EXECS) $(OBJS) The resulting executable is run as a regular user on a client. Doing so however, consistently crashes the MDS server and the client. We are running the current version of Lustre 1.6.5.1 Any idea what could be going wrong here? Thanks. Suvendra.
Since this got no response, I wanted to add that fundamentally we just want to get group quota limits. So right now we are reduced to calling lfs quota -g group and then parsing the output of that call to something sensible and printing to screen. Is this the expected protocol? Any thought on how to make this work seamlessly through linux quota? Thanks. Suvendra. On 8/18/08 4:02 PM, "Suvendra Dutta" <suvendra_dutta at harvard.edu> wrote:> I am trying to run the Code: > #include <stdio.h> > #include <unistd.h> > #include <lustre/liblustreapi.h> > #include <sys/types.h> > #include <pwd.h> > #include <string.h> > #include <errno.h> > > int main(int argc, char *argv[]) > { > struct if_quotactl qctl; > char szpath[FILENAME_MAX]; > struct passwd *pw; > uid_t uid; > gid_t gid; > int rc; > > pw = getpwuid(geteuid()); > > if (!pw) { > fprintf(stderr, "%s: getpwuid on geteuid failed!\n", argv[0]); > return -1; > } > uid = pw->pw_uid; > gid = pw->pw_gid; > sprintf(szpath, "/n/circelfs"); > memset(&qctl, 0, sizeof(qctl)); > qctl.qc_cmd = LUSTRE_Q_GETQUOTA; > qctl.qc_id = gid; > qctl.qc_type = UGQUOTA; > > rc = llapi_quotactl(szpath, &qctl); > if (rc) { > fprintf(stderr, "%s: llapi_quotactl %s: %s\n", > argv[0], szpath, strerror(errno)); > return rc; > } > struct obd_dqblk *dqb = &qctl.qc_dqblk; > printf("Quota for %s on %s: %ld\n", pw->pw_name, szpath, > dqb->dqb_bhardlimit*QUOTABLOCK_SIZE); > return 0; > } > > Compiled using the Makefile: > CC=gcc > CFLAGS=-g > LIBS=-llustreapi -lm > RM=/bin/rm > > EXECS = rquota > OBJS = rquota.o > > all: $(EXECS) > > $(EXECS): $(OBJS) Makefile > $(CC) $(CFLAGS) -o $(EXECS) $(OBJS) $(LIBS) > > $(OBJS): Makefile > > .c.o: > $(CC) $(CFLAGS) -o $*.o -c $*.c > clean: > $(RM) -f $(EXECS) $(OBJS) > > > The resulting executable is run as a regular user on a client. > > Doing so however, consistently crashes the MDS server and the client. We are > running the current version of Lustre 1.6.5.1 > > Any idea what could be going wrong here? > > Thanks. > > Suvendra. > > _______________________________________________ > Lustre-discuss mailing list > Lustre-discuss at lists.lustre.org > http://lists.lustre.org/mailman/listinfo/lustre-discuss >
On Aug 19, 2008 10:36 -0400, Suvendra Nath Dutta wrote:> Since this got no response, I wanted to add that fundamentally we just want > to get group quota limits. So right now we are reduced to calling lfs quota > -g group and then parsing the output of that call to something sensible and > printing to screen. Is this the expected protocol? Any thought on how to > make this work seamlessly through linux quota?The problem with the linux quota tools (and the API in general) is that it requires a block device to work on, which just doesn''t exist for a network filesystem. I know that both LLNL and NERSC have modified quota tools that work for both Lustre and other filesystems, using the llapi_quotactl() function instead of calling the quotactl() syscall for Lustre filesystems. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.
My first post was code based on Jim Garlick''s rquota code. That is what crashed the MDS. Suvendra. On 8/21/08 5:12 AM, "Andreas Dilger" <adilger at sun.com> wrote:> On Aug 19, 2008 10:36 -0400, Suvendra Nath Dutta wrote: >> Since this got no response, I wanted to add that fundamentally we just want >> to get group quota limits. So right now we are reduced to calling lfs quota >> -g group and then parsing the output of that call to something sensible and >> printing to screen. Is this the expected protocol? Any thought on how to >> make this work seamlessly through linux quota? > > The problem with the linux quota tools (and the API in general) is that > it requires a block device to work on, which just doesn''t exist for a > network filesystem. > > I know that both LLNL and NERSC have modified quota tools that work for > both Lustre and other filesystems, using the llapi_quotactl() function > instead of calling the quotactl() syscall for Lustre filesystems. > > Cheers, Andreas > -- > Andreas Dilger > Sr. Staff Engineer, Lustre Group > Sun Microsystems of Canada, Inc. >
Just to be clear. The rquota code worked fine (but didn''t do group quotas). My changes to the code caused the problems. Suvendra -----Original Message----- From: lustre-discuss-bounces at lists.lustre.org To: Andreas Dilger CC: Tian ZhiYong; lustre-discuss at lists.lustre.org Sent: Thu Aug 21 07:25:18 2008 Subject: Re: [Lustre-discuss] Liblustreapi crash My first post was code based on Jim Garlick''s rquota code. That is what crashed the MDS. Suvendra. On 8/21/08 5:12 AM, "Andreas Dilger" <adilger at sun.com> wrote:> On Aug 19, 2008 10:36 -0400, Suvendra Nath Dutta wrote: >> Since this got no response, I wanted to add that fundamentally we just want >> to get group quota limits. So right now we are reduced to calling lfs quota >> -g group and then parsing the output of that call to something sensible and >> printing to screen. Is this the expected protocol? Any thought on how to >> make this work seamlessly through linux quota? > > The problem with the linux quota tools (and the API in general) is that > it requires a block device to work on, which just doesn''t exist for a > network filesystem. > > I know that both LLNL and NERSC have modified quota tools that work for > both Lustre and other filesystems, using the llapi_quotactl() function > instead of calling the quotactl() syscall for Lustre filesystems. > > Cheers, Andreas > -- > Andreas Dilger > Sr. Staff Engineer, Lustre Group > Sun Microsystems of Canada, Inc. >_______________________________________________ Lustre-discuss mailing list Lustre-discuss at lists.lustre.org http://lists.lustre.org/mailman/listinfo/lustre-discuss -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.lustre.org/pipermail/lustre-discuss/attachments/20080821/27a72950/attachment.html
On Mon, Aug 18, 2008 at 04:02:26PM -0400, Suvendra Nath Dutta wrote:> uid = pw->pw_uid; > gid = pw->pw_gid; > sprintf(szpath, "/n/circelfs"); > memset(&qctl, 0, sizeof(qctl)); > qctl.qc_cmd = LUSTRE_Q_GETQUOTA; > qctl.qc_id = gid; > qctl.qc_type = UGQUOTA;In this case, you want to get the quota limit and usage for a particular group, so qc_type should be set to GRPQUOTA. FYI, we have recently (will be available in 1.6.6) added a man page for llapi_quotactl: https://bugzilla.lustre.org/attachment.cgi?id=17864 That being said, we should return an error and no nodes should crash when passing a wrong value for lqc_type. Could you please file a bugzilla ticket for this? Thanks in advance. Cheers, Johann