Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 326187
Collapse All | Expand All

(-)a/src/plugins/quota/quota-fs.c (-10 / +27 lines)
Lines 164-170 Link Here
164
	mount->fd = -1;
164
	mount->fd = -1;
165
#endif
165
#endif
166
166
167
	if (strcmp(mount->type, "nfs") == 0) {
167
	if (strcmp(mount->type, "nfs") == 0 || strcmp(mount->type, "nfs4") == 0) {
168
		if (strchr(mount->device_path, ':') == NULL) {
168
		if (strchr(mount->device_path, ':') == NULL) {
169
			i_error("quota-fs: %s is not a valid NFS device path",
169
			i_error("quota-fs: %s is not a valid NFS device path",
170
				mount->device_path);
170
				mount->device_path);
Lines 210-216 Link Here
210
210
211
#ifdef FS_QUOTA_SOLARIS
211
#ifdef FS_QUOTA_SOLARIS
212
#ifdef HAVE_RQUOTA
212
#ifdef HAVE_RQUOTA
213
	if (strcmp(mount->type, "nfs") == 0) {
213
	if (strcmp(mount->type, "nfs") == 0 || strcmp(mount->type, "nfs4") == 0) {
214
		/* using rquota for this mount */
214
		/* using rquota for this mount */
215
	} else
215
	} else
216
#endif
216
#endif
Lines 319-324 Link Here
319
319
320
	host = t_strdup_until(mount->device_path, path);
320
	host = t_strdup_until(mount->device_path, path);
321
	path++;
321
	path++;
322
	/* For NFSv4, we send the filesystem path without initial /. Server prepends proper
323
	 * NFS pseudoroot automatically and uses this for detection of NFSv4 mounts. */
324
	if (strcmp(root->mount->type, "nfs4") == 0)
325
		while (*path == '/')
326
			path++;
322
327
323
	if (root->root.quota->set->debug) {
328
	if (root->root.quota->set->debug) {
324
		i_info("quota-fs: host=%s, path=%s, uid=%s, %s",
329
		i_info("quota-fs: host=%s, path=%s, uid=%s, %s",
Lines 366-382 Link Here
366
		/* convert the results from blocks to bytes */
371
		/* convert the results from blocks to bytes */
367
		const rquota *rq = &result.getquota_rslt_u.gqr_rquota;
372
		const rquota *rq = &result.getquota_rslt_u.gqr_rquota;
368
373
369
		if (rq->rq_active) {
374
		if (bytes) {
370
			if (bytes) {
375
			*value_r = (uint64_t)rq->rq_curblocks *
371
				*value_r = (uint64_t)rq->rq_curblocks *
376
				(uint64_t)rq->rq_bsize;
372
					(uint64_t)rq->rq_bsize;
377
			if (rq->rq_bsoftlimit) {
373
				*limit_r = (uint64_t)rq->rq_bsoftlimit *
378
				*limit_r = (uint64_t)rq->rq_bsoftlimit *
374
					(uint64_t)rq->rq_bsize;
379
					(uint64_t)rq->rq_bsize;
375
			} else {
380
			} else {
376
				*value_r = rq->rq_curfiles;
381
				*limit_r = (uint64_t)rq->rq_bhardlimit *
377
				*limit_r = rq->rq_fsoftlimit;
382
					(uint64_t)rq->rq_bsize;
378
			}
383
			}
384
		} else {
385
			*value_r = rq->rq_curfiles;
386
			if (rq->rq_fsoftlimit)
387
				*limit_r = rq->rq_fsoftlimit;
388
			else
389
				*limit_r = rq->rq_fhardlimit;
379
		}
390
		}
391
		
380
		if (root->root.quota->set->debug) {
392
		if (root->root.quota->set->debug) {
381
			i_info("quota-fs: uid=%s, value=%llu, "
393
			i_info("quota-fs: uid=%s, value=%llu, "
382
			       "limit=%llu, active=%d", dec2str(root->uid),
394
			       "limit=%llu, active=%d", dec2str(root->uid),
Lines 419-425 Link Here
419
431
420
	host = t_strdup_until(mount->device_path, path);
432
	host = t_strdup_until(mount->device_path, path);
421
	path++;
433
	path++;
422
434
	/* For NFSv4, we send the filesystem path without initial /. Server prepends proper
435
	 * NFS pseudoroot automatically and uses this for detection of NFSv4 mounts. */
436
	if (strcmp(root->mount->type, "nfs4") == 0)
437
		while (*path == '/')
438
			path++;
439
	
423
	if (root->root.quota->set->debug) {
440
	if (root->root.quota->set->debug) {
424
		i_info("quota-fs: host=%s, path=%s, gid=%s, %s",
441
		i_info("quota-fs: host=%s, path=%s, gid=%s, %s",
425
		       host, path, dec2str(root->gid),
442
		       host, path, dec2str(root->gid),
Lines 761-767 Link Here
761
	bytes = strcasecmp(name, QUOTA_NAME_STORAGE_BYTES) == 0;
778
	bytes = strcasecmp(name, QUOTA_NAME_STORAGE_BYTES) == 0;
762
779
763
#ifdef HAVE_RQUOTA
780
#ifdef HAVE_RQUOTA
764
	if (strcmp(root->mount->type, "nfs") == 0) {
781
	if (strcmp(root->mount->type, "nfs") == 0 || strcmp(root->mount->type, "nfs4") == 0) {
765
		T_BEGIN {
782
		T_BEGIN {
766
			ret = !root->user_disabled ?
783
			ret = !root->user_disabled ?
767
				do_rquota_user(root, bytes, value_r, &limit) :
784
				do_rquota_user(root, bytes, value_r, &limit) :

Return to bug 326187