1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# Description: fix repquota to get latest quota info header
# Author: Jan Kara
diff -u quota/quotaio.c quota-tools/quotaio.c
--- quota/quotaio.c 2010-07-28 11:14:02.000000000 +0200
+++ quota-tools/quotaio.c 2010-05-28 09:05:21.000000000 +0200
@@ -147,6 +147,15 @@
}
}
if (!QIO_ENABLED(h) || flags & IOI_OPENFILE) { /* Need to open file? */
+ if (QIO_ENABLED(h)) { /* Kernel uses same file? */
+ unsigned int cmd =
+ (kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
+ if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
+ 0, NULL) < 0) {
+ die(4, _("Cannot sync quotas on device %s: %s\n"),
+ h->qh_quotadev, strerror(errno));
+ }
+ }
/* We still need to open file for operations like 'repquota' */
if ((fd = open(qfname, QIO_RO(h) ? O_RDONLY : O_RDWR)) < 0) {
errstr(_("Cannot open quotafile %s: %s\n"),
diff -u quota/quotaio_v1.c quota-tools/quotaio_v1.c
--- quota/quotaio_v1.c 2010-07-26 18:48:24.000000000 +0200
+++ quota-tools/quotaio_v1.c 2010-05-28 09:05:23.000000000 +0200
@@ -348,11 +348,6 @@
struct dquot *dquot = get_empty_dquot();
qid_t id = 0;
- if (QIO_ENABLED(h)) /* Kernel uses same file? */
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
- h->qh_quotadev, 0, NULL) < 0)
- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
- strerror(errno));
memset(dquot, 0, sizeof(*dquot));
dquot->dq_h = h;
lseek(h->qh_fd, 0, SEEK_SET);
diff -u quota/quotaio_v2.c quota-tools/quotaio_v2.c
--- quota/quotaio_v2.c 2010-02-18 09:44:11.000000000 +0100
+++ quota-tools/quotaio_v2.c 2010-05-28 09:05:23.000000000 +0200
@@ -484,11 +484,6 @@
static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *, char *))
{
- if (QIO_ENABLED(h)) /* Kernel uses same file? */
- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
- h->qh_quotadev, 0, NULL) < 0)
- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
- strerror(errno));
return qtree_scan_dquots(h, process_dquot);
}
diff -u quota/quotasys.c quota-tools/quotasys.c
--- quota/quotasys.c 2010-07-28 11:14:02.000000000 +0200
+++ quota-tools/quotasys.c 2010-06-15 10:11:30.000000000 +0200
@@ -861,22 +861,23 @@
if (kernel_iface == IFACE_GENERIC) {
int actfmt;
- if (quotactl(QCMD(Q_GETFMT, type), dev, 0, (void *)&actfmt) < 0)
- return -1;
- actfmt = kern2utilfmt(actfmt);
- if (actfmt < 0)
- return -1;
- return actfmt;
+ if (quotactl(QCMD(Q_GETFMT, type), dev, 0,
+ (void *)&actfmt) >= 0) {
+ actfmt = kern2utilfmt(actfmt);
+ if (actfmt >= 0)
+ return actfmt;
+ }
+ } else {
+ if ((fmt == -1 || fmt == QF_VFSV0) &&
+ v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
+ return QF_VFSV0;
+ if ((fmt == -1 || fmt == QF_VFSOLD) &&
+ v1_kern_quota_on(dev, type)) /* Old quota format */
+ return QF_VFSOLD;
}
- if ((fmt == -1 || fmt == QF_VFSV0) &&
- v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
- return QF_VFSV0;
if ((fmt == -1 || fmt == QF_XFS) &&
xfs_kern_quota_on(dev, type)) /* XFS quota format */
return QF_XFS;
- if ((fmt == -1 || fmt == QF_VFSOLD) &&
- v1_kern_quota_on(dev, type)) /* Old quota format */
- return QF_VFSOLD;
return -1;
}
|