Skip to content

Commit 320e58d

Browse files
committed
Extend PF_FSTRANS critical regions
Additional testing has shown that the region covered by PF_FSTRANS needs to be extended to cover the zpl_xattr_security_init() and init_acl() functions. The zpl_mark_dirty() function can also recurse and therefore must always be protected. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #3331
1 parent 4ec7b85 commit 320e58d

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

module/zfs/zpl_inode.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
106106

107107
cookie = spl_fstrans_mark();
108108
error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
109-
spl_fstrans_unmark(cookie);
110109
if (error == 0) {
111110
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
112111
VERIFY0(zpl_init_acl(ip, dir));
113112
d_instantiate(dentry, ip);
114113
}
115114

115+
spl_fstrans_unmark(cookie);
116116
kmem_free(vap, sizeof (vattr_t));
117117
crfree(cr);
118118
ASSERT3S(error, <=, 0);
@@ -144,13 +144,13 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
144144

145145
cookie = spl_fstrans_mark();
146146
error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
147-
spl_fstrans_unmark(cookie);
148147
if (error == 0) {
149148
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
150149
VERIFY0(zpl_init_acl(ip, dir));
151150
d_instantiate(dentry, ip);
152151
}
153152

153+
spl_fstrans_unmark(cookie);
154154
kmem_free(vap, sizeof (vattr_t));
155155
crfree(cr);
156156
ASSERT3S(error, <=, 0);
@@ -190,13 +190,13 @@ zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
190190

191191
cookie = spl_fstrans_mark();
192192
error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL);
193-
spl_fstrans_unmark(cookie);
194193
if (error == 0) {
195194
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
196195
VERIFY0(zpl_init_acl(ip, dir));
197196
d_instantiate(dentry, ip);
198197
}
199198

199+
spl_fstrans_unmark(cookie);
200200
kmem_free(vap, sizeof (vattr_t));
201201
crfree(cr);
202202
ASSERT3S(error, <=, 0);
@@ -273,10 +273,10 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
273273

274274
cookie = spl_fstrans_mark();
275275
error = -zfs_setattr(ip, vap, 0, cr);
276-
spl_fstrans_unmark(cookie);
277276
if (!error && (ia->ia_valid & ATTR_MODE))
278277
error = zpl_chmod_acl(ip);
279278

279+
spl_fstrans_unmark(cookie);
280280
kmem_free(vap, sizeof (vattr_t));
281281
crfree(cr);
282282
ASSERT3S(error, <=, 0);
@@ -317,12 +317,12 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
317317

318318
cookie = spl_fstrans_mark();
319319
error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
320-
spl_fstrans_unmark(cookie);
321320
if (error == 0) {
322321
VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
323322
d_instantiate(dentry, ip);
324323
}
325324

325+
spl_fstrans_unmark(cookie);
326326
kmem_free(vap, sizeof (vattr_t));
327327
crfree(cr);
328328
ASSERT3S(error, <=, 0);
@@ -391,14 +391,14 @@ zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
391391

392392
cookie = spl_fstrans_mark();
393393
error = -zfs_link(dir, ip, dname(dentry), cr);
394-
spl_fstrans_unmark(cookie);
395394
if (error) {
396395
iput(ip);
397396
goto out;
398397
}
399398

400399
d_instantiate(dentry, ip);
401400
out:
401+
spl_fstrans_unmark(cookie);
402402
crfree(cr);
403403
ASSERT3S(error, <=, 0);
404404

module/zfs/zpl_super.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,21 @@ zpl_inode_destroy(struct inode *ip)
5757
static void
5858
zpl_dirty_inode(struct inode *ip, int flags)
5959
{
60+
fstrans_cookie_t cookie;
61+
62+
cookie = spl_fstrans_mark();
6063
zfs_dirty_inode(ip, flags);
64+
spl_fstrans_unmark(cookie);
6165
}
6266
#else
6367
static void
6468
zpl_dirty_inode(struct inode *ip)
6569
{
70+
fstrans_cookie_t cookie;
71+
72+
cookie = spl_fstrans_mark();
6673
zfs_dirty_inode(ip, 0);
74+
spl_fstrans_unmark(cookie);
6775
}
6876
#endif /* HAVE_DIRTY_INODE_WITH_FLAGS */
6977

0 commit comments

Comments
 (0)