diff options
author | David Howells <dhowells@redhat.com> | 2015-03-17 18:25:59 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-15 15:06:57 -0400 |
commit | 2b0143b5c986be1ce8408b3aadc4709e0a94429d (patch) | |
tree | 98b1dee70f3d5d9ac9309f4638e41864ddcd0952 /fs/reiserfs | |
parent | ce0b16ddf18df35026164fda4a642ef10c01f442 (diff) |
VFS: normal filesystems (and lustre): d_inode() annotations
that's the bulk of filesystem drivers dealing with inodes of their own
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/dir.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 12 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 126 | ||||
-rw-r--r-- | fs/reiserfs/xattr.h | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_security.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/xattr_trusted.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/xattr_user.c | 4 |
9 files changed, 87 insertions, 87 deletions
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 0a7dc941aaf4..4a024e2ceb9f 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -53,8 +53,8 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
53 | static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh) | 53 | static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *deh) |
54 | { | 54 | { |
55 | struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root; | 55 | struct dentry *privroot = REISERFS_SB(dir->i_sb)->priv_root; |
56 | return (privroot->d_inode && | 56 | return (d_really_is_positive(privroot) && |
57 | deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid); | 57 | deh->deh_objectid == INODE_PKEY(d_inode(privroot))->k_objectid); |
58 | } | 58 | } |
59 | 59 | ||
60 | int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx) | 60 | int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx) |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 742242b60972..f6f2fbad9777 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -3308,7 +3308,7 @@ static ssize_t reiserfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
3308 | 3308 | ||
3309 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3309 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |
3310 | { | 3310 | { |
3311 | struct inode *inode = dentry->d_inode; | 3311 | struct inode *inode = d_inode(dentry); |
3312 | unsigned int ia_valid; | 3312 | unsigned int ia_valid; |
3313 | int error; | 3313 | int error; |
3314 | 3314 | ||
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index cd11358b10c7..b55a074653d7 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -400,7 +400,7 @@ struct dentry *reiserfs_get_parent(struct dentry *child) | |||
400 | struct inode *inode = NULL; | 400 | struct inode *inode = NULL; |
401 | struct reiserfs_dir_entry de; | 401 | struct reiserfs_dir_entry de; |
402 | INITIALIZE_PATH(path_to_entry); | 402 | INITIALIZE_PATH(path_to_entry); |
403 | struct inode *dir = child->d_inode; | 403 | struct inode *dir = d_inode(child); |
404 | 404 | ||
405 | if (dir->i_nlink == 0) { | 405 | if (dir->i_nlink == 0) { |
406 | return ERR_PTR(-ENOENT); | 406 | return ERR_PTR(-ENOENT); |
@@ -917,7 +917,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
917 | goto end_rmdir; | 917 | goto end_rmdir; |
918 | } | 918 | } |
919 | 919 | ||
920 | inode = dentry->d_inode; | 920 | inode = d_inode(dentry); |
921 | 921 | ||
922 | reiserfs_update_inode_transaction(inode); | 922 | reiserfs_update_inode_transaction(inode); |
923 | reiserfs_update_inode_transaction(dir); | 923 | reiserfs_update_inode_transaction(dir); |
@@ -987,7 +987,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) | |||
987 | 987 | ||
988 | dquot_initialize(dir); | 988 | dquot_initialize(dir); |
989 | 989 | ||
990 | inode = dentry->d_inode; | 990 | inode = d_inode(dentry); |
991 | 991 | ||
992 | /* | 992 | /* |
993 | * in this transaction we can be doing at max two balancings and | 993 | * in this transaction we can be doing at max two balancings and |
@@ -1174,7 +1174,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1174 | struct dentry *dentry) | 1174 | struct dentry *dentry) |
1175 | { | 1175 | { |
1176 | int retval; | 1176 | int retval; |
1177 | struct inode *inode = old_dentry->d_inode; | 1177 | struct inode *inode = d_inode(old_dentry); |
1178 | struct reiserfs_transaction_handle th; | 1178 | struct reiserfs_transaction_handle th; |
1179 | /* | 1179 | /* |
1180 | * We need blocks for transaction + update of quotas for | 1180 | * We need blocks for transaction + update of quotas for |
@@ -1311,8 +1311,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1311 | dquot_initialize(old_dir); | 1311 | dquot_initialize(old_dir); |
1312 | dquot_initialize(new_dir); | 1312 | dquot_initialize(new_dir); |
1313 | 1313 | ||
1314 | old_inode = old_dentry->d_inode; | 1314 | old_inode = d_inode(old_dentry); |
1315 | new_dentry_inode = new_dentry->d_inode; | 1315 | new_dentry_inode = d_inode(new_dentry); |
1316 | 1316 | ||
1317 | /* | 1317 | /* |
1318 | * make sure that oldname still exists and points to an object we | 1318 | * make sure that oldname still exists and points to an object we |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 71fbbe3e2dab..558ef2ce1bdd 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -1687,7 +1687,7 @@ static __u32 find_hash_out(struct super_block *s) | |||
1687 | __u32 hash = DEFAULT_HASH; | 1687 | __u32 hash = DEFAULT_HASH; |
1688 | __u32 deh_hashval, teahash, r5hash, yurahash; | 1688 | __u32 deh_hashval, teahash, r5hash, yurahash; |
1689 | 1689 | ||
1690 | inode = s->s_root->d_inode; | 1690 | inode = d_inode(s->s_root); |
1691 | 1691 | ||
1692 | make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3); | 1692 | make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3); |
1693 | retval = search_by_entry_key(s, &key, &path, &de); | 1693 | retval = search_by_entry_key(s, &key, &path, &de); |
@@ -2347,7 +2347,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2347 | err = -EXDEV; | 2347 | err = -EXDEV; |
2348 | goto out; | 2348 | goto out; |
2349 | } | 2349 | } |
2350 | inode = path->dentry->d_inode; | 2350 | inode = d_inode(path->dentry); |
2351 | /* | 2351 | /* |
2352 | * We must not pack tails for quota files on reiserfs for quota | 2352 | * We must not pack tails for quota files on reiserfs for quota |
2353 | * IO to work | 2353 | * IO to work |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 4e781e697c90..e87f9b52bf06 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -87,9 +87,9 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry) | |||
87 | 87 | ||
88 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 88 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
89 | 89 | ||
90 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 90 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
91 | error = dir->i_op->unlink(dir, dentry); | 91 | error = dir->i_op->unlink(dir, dentry); |
92 | mutex_unlock(&dentry->d_inode->i_mutex); | 92 | mutex_unlock(&d_inode(dentry)->i_mutex); |
93 | 93 | ||
94 | if (!error) | 94 | if (!error) |
95 | d_delete(dentry); | 95 | d_delete(dentry); |
@@ -102,11 +102,11 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
102 | 102 | ||
103 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 103 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
104 | 104 | ||
105 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD); | 105 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); |
106 | error = dir->i_op->rmdir(dir, dentry); | 106 | error = dir->i_op->rmdir(dir, dentry); |
107 | if (!error) | 107 | if (!error) |
108 | dentry->d_inode->i_flags |= S_DEAD; | 108 | d_inode(dentry)->i_flags |= S_DEAD; |
109 | mutex_unlock(&dentry->d_inode->i_mutex); | 109 | mutex_unlock(&d_inode(dentry)->i_mutex); |
110 | if (!error) | 110 | if (!error) |
111 | d_delete(dentry); | 111 | d_delete(dentry); |
112 | 112 | ||
@@ -120,26 +120,26 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags) | |||
120 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; | 120 | struct dentry *privroot = REISERFS_SB(sb)->priv_root; |
121 | struct dentry *xaroot; | 121 | struct dentry *xaroot; |
122 | 122 | ||
123 | if (!privroot->d_inode) | 123 | if (d_really_is_negative(privroot)) |
124 | return ERR_PTR(-ENODATA); | 124 | return ERR_PTR(-ENODATA); |
125 | 125 | ||
126 | mutex_lock_nested(&privroot->d_inode->i_mutex, I_MUTEX_XATTR); | 126 | mutex_lock_nested(&d_inode(privroot)->i_mutex, I_MUTEX_XATTR); |
127 | 127 | ||
128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); | 128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); |
129 | if (!xaroot) | 129 | if (!xaroot) |
130 | xaroot = ERR_PTR(-ENODATA); | 130 | xaroot = ERR_PTR(-ENODATA); |
131 | else if (!xaroot->d_inode) { | 131 | else if (d_really_is_negative(xaroot)) { |
132 | int err = -ENODATA; | 132 | int err = -ENODATA; |
133 | 133 | ||
134 | if (xattr_may_create(flags)) | 134 | if (xattr_may_create(flags)) |
135 | err = xattr_mkdir(privroot->d_inode, xaroot, 0700); | 135 | err = xattr_mkdir(d_inode(privroot), xaroot, 0700); |
136 | if (err) { | 136 | if (err) { |
137 | dput(xaroot); | 137 | dput(xaroot); |
138 | xaroot = ERR_PTR(err); | 138 | xaroot = ERR_PTR(err); |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | mutex_unlock(&privroot->d_inode->i_mutex); | 142 | mutex_unlock(&d_inode(privroot)->i_mutex); |
143 | return xaroot; | 143 | return xaroot; |
144 | } | 144 | } |
145 | 145 | ||
@@ -156,21 +156,21 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags) | |||
156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), | 156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), |
157 | inode->i_generation); | 157 | inode->i_generation); |
158 | 158 | ||
159 | mutex_lock_nested(&xaroot->d_inode->i_mutex, I_MUTEX_XATTR); | 159 | mutex_lock_nested(&d_inode(xaroot)->i_mutex, I_MUTEX_XATTR); |
160 | 160 | ||
161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); | 161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); |
162 | if (!IS_ERR(xadir) && !xadir->d_inode) { | 162 | if (!IS_ERR(xadir) && d_really_is_negative(xadir)) { |
163 | int err = -ENODATA; | 163 | int err = -ENODATA; |
164 | 164 | ||
165 | if (xattr_may_create(flags)) | 165 | if (xattr_may_create(flags)) |
166 | err = xattr_mkdir(xaroot->d_inode, xadir, 0700); | 166 | err = xattr_mkdir(d_inode(xaroot), xadir, 0700); |
167 | if (err) { | 167 | if (err) { |
168 | dput(xadir); | 168 | dput(xadir); |
169 | xadir = ERR_PTR(err); | 169 | xadir = ERR_PTR(err); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | mutex_unlock(&xaroot->d_inode->i_mutex); | 173 | mutex_unlock(&d_inode(xaroot)->i_mutex); |
174 | dput(xaroot); | 174 | dput(xaroot); |
175 | return xadir; | 175 | return xadir; |
176 | } | 176 | } |
@@ -195,7 +195,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, | |||
195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); | 195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); |
196 | struct dentry *dentry; | 196 | struct dentry *dentry; |
197 | 197 | ||
198 | WARN_ON_ONCE(!mutex_is_locked(&dbuf->xadir->d_inode->i_mutex)); | 198 | WARN_ON_ONCE(!mutex_is_locked(&d_inode(dbuf->xadir)->i_mutex)); |
199 | 199 | ||
200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) | 200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) |
201 | return -ENOSPC; | 201 | return -ENOSPC; |
@@ -207,7 +207,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, | |||
207 | dentry = lookup_one_len(name, dbuf->xadir, namelen); | 207 | dentry = lookup_one_len(name, dbuf->xadir, namelen); |
208 | if (IS_ERR(dentry)) { | 208 | if (IS_ERR(dentry)) { |
209 | return PTR_ERR(dentry); | 209 | return PTR_ERR(dentry); |
210 | } else if (!dentry->d_inode) { | 210 | } else if (d_really_is_negative(dentry)) { |
211 | /* A directory entry exists, but no file? */ | 211 | /* A directory entry exists, but no file? */ |
212 | reiserfs_error(dentry->d_sb, "xattr-20003", | 212 | reiserfs_error(dentry->d_sb, "xattr-20003", |
213 | "Corrupted directory: xattr %pd listed but " | 213 | "Corrupted directory: xattr %pd listed but " |
@@ -249,16 +249,16 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
249 | if (IS_ERR(dir)) { | 249 | if (IS_ERR(dir)) { |
250 | err = PTR_ERR(dir); | 250 | err = PTR_ERR(dir); |
251 | goto out; | 251 | goto out; |
252 | } else if (!dir->d_inode) { | 252 | } else if (d_really_is_negative(dir)) { |
253 | err = 0; | 253 | err = 0; |
254 | goto out_dir; | 254 | goto out_dir; |
255 | } | 255 | } |
256 | 256 | ||
257 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); | 257 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); |
258 | 258 | ||
259 | buf.xadir = dir; | 259 | buf.xadir = dir; |
260 | while (1) { | 260 | while (1) { |
261 | err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); | 261 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
262 | if (err) | 262 | if (err) |
263 | break; | 263 | break; |
264 | if (!buf.count) | 264 | if (!buf.count) |
@@ -276,7 +276,7 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
276 | break; | 276 | break; |
277 | buf.count = 0; | 277 | buf.count = 0; |
278 | } | 278 | } |
279 | mutex_unlock(&dir->d_inode->i_mutex); | 279 | mutex_unlock(&d_inode(dir)->i_mutex); |
280 | 280 | ||
281 | cleanup_dentry_buf(&buf); | 281 | cleanup_dentry_buf(&buf); |
282 | 282 | ||
@@ -298,13 +298,13 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
298 | if (!err) { | 298 | if (!err) { |
299 | int jerror; | 299 | int jerror; |
300 | 300 | ||
301 | mutex_lock_nested(&dir->d_parent->d_inode->i_mutex, | 301 | mutex_lock_nested(&d_inode(dir->d_parent)->i_mutex, |
302 | I_MUTEX_XATTR); | 302 | I_MUTEX_XATTR); |
303 | err = action(dir, data); | 303 | err = action(dir, data); |
304 | reiserfs_write_lock(inode->i_sb); | 304 | reiserfs_write_lock(inode->i_sb); |
305 | jerror = journal_end(&th); | 305 | jerror = journal_end(&th); |
306 | reiserfs_write_unlock(inode->i_sb); | 306 | reiserfs_write_unlock(inode->i_sb); |
307 | mutex_unlock(&dir->d_parent->d_inode->i_mutex); | 307 | mutex_unlock(&d_inode(dir->d_parent)->i_mutex); |
308 | err = jerror ?: err; | 308 | err = jerror ?: err; |
309 | } | 309 | } |
310 | } | 310 | } |
@@ -319,7 +319,7 @@ out: | |||
319 | 319 | ||
320 | static int delete_one_xattr(struct dentry *dentry, void *data) | 320 | static int delete_one_xattr(struct dentry *dentry, void *data) |
321 | { | 321 | { |
322 | struct inode *dir = dentry->d_parent->d_inode; | 322 | struct inode *dir = d_inode(dentry->d_parent); |
323 | 323 | ||
324 | /* This is the xattr dir, handle specially. */ | 324 | /* This is the xattr dir, handle specially. */ |
325 | if (d_is_dir(dentry)) | 325 | if (d_is_dir(dentry)) |
@@ -384,27 +384,27 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
384 | if (IS_ERR(xadir)) | 384 | if (IS_ERR(xadir)) |
385 | return ERR_CAST(xadir); | 385 | return ERR_CAST(xadir); |
386 | 386 | ||
387 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | 387 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); |
388 | xafile = lookup_one_len(name, xadir, strlen(name)); | 388 | xafile = lookup_one_len(name, xadir, strlen(name)); |
389 | if (IS_ERR(xafile)) { | 389 | if (IS_ERR(xafile)) { |
390 | err = PTR_ERR(xafile); | 390 | err = PTR_ERR(xafile); |
391 | goto out; | 391 | goto out; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (xafile->d_inode && (flags & XATTR_CREATE)) | 394 | if (d_really_is_positive(xafile) && (flags & XATTR_CREATE)) |
395 | err = -EEXIST; | 395 | err = -EEXIST; |
396 | 396 | ||
397 | if (!xafile->d_inode) { | 397 | if (d_really_is_negative(xafile)) { |
398 | err = -ENODATA; | 398 | err = -ENODATA; |
399 | if (xattr_may_create(flags)) | 399 | if (xattr_may_create(flags)) |
400 | err = xattr_create(xadir->d_inode, xafile, | 400 | err = xattr_create(d_inode(xadir), xafile, |
401 | 0700|S_IFREG); | 401 | 0700|S_IFREG); |
402 | } | 402 | } |
403 | 403 | ||
404 | if (err) | 404 | if (err) |
405 | dput(xafile); | 405 | dput(xafile); |
406 | out: | 406 | out: |
407 | mutex_unlock(&xadir->d_inode->i_mutex); | 407 | mutex_unlock(&d_inode(xadir)->i_mutex); |
408 | dput(xadir); | 408 | dput(xadir); |
409 | if (err) | 409 | if (err) |
410 | return ERR_PTR(err); | 410 | return ERR_PTR(err); |
@@ -469,21 +469,21 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
469 | if (IS_ERR(xadir)) | 469 | if (IS_ERR(xadir)) |
470 | return PTR_ERR(xadir); | 470 | return PTR_ERR(xadir); |
471 | 471 | ||
472 | mutex_lock_nested(&xadir->d_inode->i_mutex, I_MUTEX_XATTR); | 472 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); |
473 | dentry = lookup_one_len(name, xadir, strlen(name)); | 473 | dentry = lookup_one_len(name, xadir, strlen(name)); |
474 | if (IS_ERR(dentry)) { | 474 | if (IS_ERR(dentry)) { |
475 | err = PTR_ERR(dentry); | 475 | err = PTR_ERR(dentry); |
476 | goto out_dput; | 476 | goto out_dput; |
477 | } | 477 | } |
478 | 478 | ||
479 | if (dentry->d_inode) { | 479 | if (d_really_is_positive(dentry)) { |
480 | err = xattr_unlink(xadir->d_inode, dentry); | 480 | err = xattr_unlink(d_inode(xadir), dentry); |
481 | update_ctime(inode); | 481 | update_ctime(inode); |
482 | } | 482 | } |
483 | 483 | ||
484 | dput(dentry); | 484 | dput(dentry); |
485 | out_dput: | 485 | out_dput: |
486 | mutex_unlock(&xadir->d_inode->i_mutex); | 486 | mutex_unlock(&d_inode(xadir)->i_mutex); |
487 | dput(xadir); | 487 | dput(xadir); |
488 | return err; | 488 | return err; |
489 | } | 489 | } |
@@ -533,7 +533,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
533 | else | 533 | else |
534 | chunk = buffer_size - buffer_pos; | 534 | chunk = buffer_size - buffer_pos; |
535 | 535 | ||
536 | page = reiserfs_get_page(dentry->d_inode, file_pos); | 536 | page = reiserfs_get_page(d_inode(dentry), file_pos); |
537 | if (IS_ERR(page)) { | 537 | if (IS_ERR(page)) { |
538 | err = PTR_ERR(page); | 538 | err = PTR_ERR(page); |
539 | goto out_unlock; | 539 | goto out_unlock; |
@@ -573,18 +573,18 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
573 | } | 573 | } |
574 | 574 | ||
575 | new_size = buffer_size + sizeof(struct reiserfs_xattr_header); | 575 | new_size = buffer_size + sizeof(struct reiserfs_xattr_header); |
576 | if (!err && new_size < i_size_read(dentry->d_inode)) { | 576 | if (!err && new_size < i_size_read(d_inode(dentry))) { |
577 | struct iattr newattrs = { | 577 | struct iattr newattrs = { |
578 | .ia_ctime = current_fs_time(inode->i_sb), | 578 | .ia_ctime = current_fs_time(inode->i_sb), |
579 | .ia_size = new_size, | 579 | .ia_size = new_size, |
580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
581 | }; | 581 | }; |
582 | 582 | ||
583 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | 583 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_XATTR); |
584 | inode_dio_wait(dentry->d_inode); | 584 | inode_dio_wait(d_inode(dentry)); |
585 | 585 | ||
586 | err = reiserfs_setattr(dentry, &newattrs); | 586 | err = reiserfs_setattr(dentry, &newattrs); |
587 | mutex_unlock(&dentry->d_inode->i_mutex); | 587 | mutex_unlock(&d_inode(dentry)->i_mutex); |
588 | } else | 588 | } else |
589 | update_ctime(inode); | 589 | update_ctime(inode); |
590 | out_unlock: | 590 | out_unlock: |
@@ -657,7 +657,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer, | |||
657 | 657 | ||
658 | down_read(&REISERFS_I(inode)->i_xattr_sem); | 658 | down_read(&REISERFS_I(inode)->i_xattr_sem); |
659 | 659 | ||
660 | isize = i_size_read(dentry->d_inode); | 660 | isize = i_size_read(d_inode(dentry)); |
661 | 661 | ||
662 | /* Just return the size needed */ | 662 | /* Just return the size needed */ |
663 | if (buffer == NULL) { | 663 | if (buffer == NULL) { |
@@ -680,7 +680,7 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer, | |||
680 | else | 680 | else |
681 | chunk = isize - file_pos; | 681 | chunk = isize - file_pos; |
682 | 682 | ||
683 | page = reiserfs_get_page(dentry->d_inode, file_pos); | 683 | page = reiserfs_get_page(d_inode(dentry), file_pos); |
684 | if (IS_ERR(page)) { | 684 | if (IS_ERR(page)) { |
685 | err = PTR_ERR(page); | 685 | err = PTR_ERR(page); |
686 | goto out_unlock; | 686 | goto out_unlock; |
@@ -775,7 +775,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, | |||
775 | 775 | ||
776 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 776 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
777 | 777 | ||
778 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 778 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
779 | return -EOPNOTSUPP; | 779 | return -EOPNOTSUPP; |
780 | 780 | ||
781 | return handler->get(dentry, name, buffer, size, handler->flags); | 781 | return handler->get(dentry, name, buffer, size, handler->flags); |
@@ -784,7 +784,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer, | |||
784 | /* | 784 | /* |
785 | * Inode operation setxattr() | 785 | * Inode operation setxattr() |
786 | * | 786 | * |
787 | * dentry->d_inode->i_mutex down | 787 | * d_inode(dentry)->i_mutex down |
788 | */ | 788 | */ |
789 | int | 789 | int |
790 | reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | 790 | reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
@@ -794,7 +794,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
794 | 794 | ||
795 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 795 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
796 | 796 | ||
797 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 797 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
798 | return -EOPNOTSUPP; | 798 | return -EOPNOTSUPP; |
799 | 799 | ||
800 | return handler->set(dentry, name, value, size, flags, handler->flags); | 800 | return handler->set(dentry, name, value, size, flags, handler->flags); |
@@ -803,7 +803,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
803 | /* | 803 | /* |
804 | * Inode operation removexattr() | 804 | * Inode operation removexattr() |
805 | * | 805 | * |
806 | * dentry->d_inode->i_mutex down | 806 | * d_inode(dentry)->i_mutex down |
807 | */ | 807 | */ |
808 | int reiserfs_removexattr(struct dentry *dentry, const char *name) | 808 | int reiserfs_removexattr(struct dentry *dentry, const char *name) |
809 | { | 809 | { |
@@ -811,7 +811,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name) | |||
811 | 811 | ||
812 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); | 812 | handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name); |
813 | 813 | ||
814 | if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 814 | if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
815 | return -EOPNOTSUPP; | 815 | return -EOPNOTSUPP; |
816 | 816 | ||
817 | return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); | 817 | return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); |
@@ -875,14 +875,14 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
875 | .size = buffer ? size : 0, | 875 | .size = buffer ? size : 0, |
876 | }; | 876 | }; |
877 | 877 | ||
878 | if (!dentry->d_inode) | 878 | if (d_really_is_negative(dentry)) |
879 | return -EINVAL; | 879 | return -EINVAL; |
880 | 880 | ||
881 | if (!dentry->d_sb->s_xattr || | 881 | if (!dentry->d_sb->s_xattr || |
882 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 882 | get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
883 | return -EOPNOTSUPP; | 883 | return -EOPNOTSUPP; |
884 | 884 | ||
885 | dir = open_xa_dir(dentry->d_inode, XATTR_REPLACE); | 885 | dir = open_xa_dir(d_inode(dentry), XATTR_REPLACE); |
886 | if (IS_ERR(dir)) { | 886 | if (IS_ERR(dir)) { |
887 | err = PTR_ERR(dir); | 887 | err = PTR_ERR(dir); |
888 | if (err == -ENODATA) | 888 | if (err == -ENODATA) |
@@ -890,9 +890,9 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
890 | goto out; | 890 | goto out; |
891 | } | 891 | } |
892 | 892 | ||
893 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); | 893 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); |
894 | err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx); | 894 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
895 | mutex_unlock(&dir->d_inode->i_mutex); | 895 | mutex_unlock(&d_inode(dir)->i_mutex); |
896 | 896 | ||
897 | if (!err) | 897 | if (!err) |
898 | err = buf.pos; | 898 | err = buf.pos; |
@@ -905,12 +905,12 @@ out: | |||
905 | static int create_privroot(struct dentry *dentry) | 905 | static int create_privroot(struct dentry *dentry) |
906 | { | 906 | { |
907 | int err; | 907 | int err; |
908 | struct inode *inode = dentry->d_parent->d_inode; | 908 | struct inode *inode = d_inode(dentry->d_parent); |
909 | 909 | ||
910 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | 910 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); |
911 | 911 | ||
912 | err = xattr_mkdir(inode, dentry, 0700); | 912 | err = xattr_mkdir(inode, dentry, 0700); |
913 | if (err || !dentry->d_inode) { | 913 | if (err || d_really_is_negative(dentry)) { |
914 | reiserfs_warning(dentry->d_sb, "jdm-20006", | 914 | reiserfs_warning(dentry->d_sb, "jdm-20006", |
915 | "xattrs/ACLs enabled and couldn't " | 915 | "xattrs/ACLs enabled and couldn't " |
916 | "find/create .reiserfs_priv. " | 916 | "find/create .reiserfs_priv. " |
@@ -918,7 +918,7 @@ static int create_privroot(struct dentry *dentry) | |||
918 | return -EOPNOTSUPP; | 918 | return -EOPNOTSUPP; |
919 | } | 919 | } |
920 | 920 | ||
921 | dentry->d_inode->i_flags |= S_PRIVATE; | 921 | d_inode(dentry)->i_flags |= S_PRIVATE; |
922 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " | 922 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " |
923 | "storage.\n", PRIVROOT_NAME); | 923 | "storage.\n", PRIVROOT_NAME); |
924 | 924 | ||
@@ -997,17 +997,17 @@ int reiserfs_lookup_privroot(struct super_block *s) | |||
997 | int err = 0; | 997 | int err = 0; |
998 | 998 | ||
999 | /* If we don't have the privroot located yet - go find it */ | 999 | /* If we don't have the privroot located yet - go find it */ |
1000 | mutex_lock(&s->s_root->d_inode->i_mutex); | 1000 | mutex_lock(&d_inode(s->s_root)->i_mutex); |
1001 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, | 1001 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, |
1002 | strlen(PRIVROOT_NAME)); | 1002 | strlen(PRIVROOT_NAME)); |
1003 | if (!IS_ERR(dentry)) { | 1003 | if (!IS_ERR(dentry)) { |
1004 | REISERFS_SB(s)->priv_root = dentry; | 1004 | REISERFS_SB(s)->priv_root = dentry; |
1005 | d_set_d_op(dentry, &xattr_lookup_poison_ops); | 1005 | d_set_d_op(dentry, &xattr_lookup_poison_ops); |
1006 | if (dentry->d_inode) | 1006 | if (d_really_is_positive(dentry)) |
1007 | dentry->d_inode->i_flags |= S_PRIVATE; | 1007 | d_inode(dentry)->i_flags |= S_PRIVATE; |
1008 | } else | 1008 | } else |
1009 | err = PTR_ERR(dentry); | 1009 | err = PTR_ERR(dentry); |
1010 | mutex_unlock(&s->s_root->d_inode->i_mutex); | 1010 | mutex_unlock(&d_inode(s->s_root)->i_mutex); |
1011 | 1011 | ||
1012 | return err; | 1012 | return err; |
1013 | } | 1013 | } |
@@ -1026,15 +1026,15 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
1026 | if (err) | 1026 | if (err) |
1027 | goto error; | 1027 | goto error; |
1028 | 1028 | ||
1029 | if (!privroot->d_inode && !(mount_flags & MS_RDONLY)) { | 1029 | if (d_really_is_negative(privroot) && !(mount_flags & MS_RDONLY)) { |
1030 | mutex_lock(&s->s_root->d_inode->i_mutex); | 1030 | mutex_lock(&d_inode(s->s_root)->i_mutex); |
1031 | err = create_privroot(REISERFS_SB(s)->priv_root); | 1031 | err = create_privroot(REISERFS_SB(s)->priv_root); |
1032 | mutex_unlock(&s->s_root->d_inode->i_mutex); | 1032 | mutex_unlock(&d_inode(s->s_root)->i_mutex); |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | if (privroot->d_inode) { | 1035 | if (d_really_is_positive(privroot)) { |
1036 | s->s_xattr = reiserfs_xattr_handlers; | 1036 | s->s_xattr = reiserfs_xattr_handlers; |
1037 | mutex_lock(&privroot->d_inode->i_mutex); | 1037 | mutex_lock(&d_inode(privroot)->i_mutex); |
1038 | if (!REISERFS_SB(s)->xattr_root) { | 1038 | if (!REISERFS_SB(s)->xattr_root) { |
1039 | struct dentry *dentry; | 1039 | struct dentry *dentry; |
1040 | 1040 | ||
@@ -1045,7 +1045,7 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
1045 | else | 1045 | else |
1046 | err = PTR_ERR(dentry); | 1046 | err = PTR_ERR(dentry); |
1047 | } | 1047 | } |
1048 | mutex_unlock(&privroot->d_inode->i_mutex); | 1048 | mutex_unlock(&d_inode(privroot)->i_mutex); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | error: | 1051 | error: |
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h index f620e9678dd5..15dde6262c00 100644 --- a/fs/reiserfs/xattr.h +++ b/fs/reiserfs/xattr.h | |||
@@ -78,7 +78,7 @@ static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | |||
78 | 78 | ||
79 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | 79 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { |
80 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 80 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
81 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | 81 | if (d_really_is_negative(REISERFS_SB(inode->i_sb)->xattr_root)) |
82 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | 82 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index e7f8939a4cb5..9a3b0616f283 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -15,10 +15,10 @@ security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
15 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 15 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
16 | return -EINVAL; | 16 | return -EINVAL; |
17 | 17 | ||
18 | if (IS_PRIVATE(dentry->d_inode)) | 18 | if (IS_PRIVATE(d_inode(dentry))) |
19 | return -EPERM; | 19 | return -EPERM; |
20 | 20 | ||
21 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 21 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
22 | } | 22 | } |
23 | 23 | ||
24 | static int | 24 | static int |
@@ -28,10 +28,10 @@ security_set(struct dentry *dentry, const char *name, const void *buffer, | |||
28 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) | 28 | if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) |
29 | return -EINVAL; | 29 | return -EINVAL; |
30 | 30 | ||
31 | if (IS_PRIVATE(dentry->d_inode)) | 31 | if (IS_PRIVATE(d_inode(dentry))) |
32 | return -EPERM; | 32 | return -EPERM; |
33 | 33 | ||
34 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 34 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
35 | } | 35 | } |
36 | 36 | ||
37 | static size_t security_list(struct dentry *dentry, char *list, size_t list_len, | 37 | static size_t security_list(struct dentry *dentry, char *list, size_t list_len, |
@@ -39,7 +39,7 @@ static size_t security_list(struct dentry *dentry, char *list, size_t list_len, | |||
39 | { | 39 | { |
40 | const size_t len = namelen + 1; | 40 | const size_t len = namelen + 1; |
41 | 41 | ||
42 | if (IS_PRIVATE(dentry->d_inode)) | 42 | if (IS_PRIVATE(d_inode(dentry))) |
43 | return 0; | 43 | return 0; |
44 | 44 | ||
45 | if (list && len <= list_len) { | 45 | if (list && len <= list_len) { |
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index 5eeb0c48ba46..e4f1343714e0 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
@@ -14,10 +14,10 @@ trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
14 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) | 14 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) |
15 | return -EINVAL; | 15 | return -EINVAL; |
16 | 16 | ||
17 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 17 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
18 | return -EPERM; | 18 | return -EPERM; |
19 | 19 | ||
20 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 20 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
21 | } | 21 | } |
22 | 22 | ||
23 | static int | 23 | static int |
@@ -27,10 +27,10 @@ trusted_set(struct dentry *dentry, const char *name, const void *buffer, | |||
27 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) | 27 | if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) |
28 | return -EINVAL; | 28 | return -EINVAL; |
29 | 29 | ||
30 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 30 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
31 | return -EPERM; | 31 | return -EPERM; |
32 | 32 | ||
33 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 33 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
34 | } | 34 | } |
35 | 35 | ||
36 | static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, | 36 | static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, |
@@ -38,7 +38,7 @@ static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, | |||
38 | { | 38 | { |
39 | const size_t len = name_len + 1; | 39 | const size_t len = name_len + 1; |
40 | 40 | ||
41 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode)) | 41 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) |
42 | return 0; | 42 | return 0; |
43 | 43 | ||
44 | if (list && len <= list_size) { | 44 | if (list && len <= list_size) { |
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index e50eab046471..d0b08d3e5689 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
@@ -15,7 +15,7 @@ user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, | |||
15 | return -EINVAL; | 15 | return -EINVAL; |
16 | if (!reiserfs_xattrs_user(dentry->d_sb)) | 16 | if (!reiserfs_xattrs_user(dentry->d_sb)) |
17 | return -EOPNOTSUPP; | 17 | return -EOPNOTSUPP; |
18 | return reiserfs_xattr_get(dentry->d_inode, name, buffer, size); | 18 | return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); |
19 | } | 19 | } |
20 | 20 | ||
21 | static int | 21 | static int |
@@ -27,7 +27,7 @@ user_set(struct dentry *dentry, const char *name, const void *buffer, | |||
27 | 27 | ||
28 | if (!reiserfs_xattrs_user(dentry->d_sb)) | 28 | if (!reiserfs_xattrs_user(dentry->d_sb)) |
29 | return -EOPNOTSUPP; | 29 | return -EOPNOTSUPP; |
30 | return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags); | 30 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
31 | } | 31 | } |
32 | 32 | ||
33 | static size_t user_list(struct dentry *dentry, char *list, size_t list_size, | 33 | static size_t user_list(struct dentry *dentry, char *list, size_t list_size, |