[Lustre-discuss] Liblustreapi crash

Suvendra Nath Dutta suvendra_dutta at harvard.edu
Tue Aug 19 07:36:27 PDT 2008


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
> 




More information about the lustre-discuss mailing list