diff options
-rw-r--r-- | fs/gfs2/bmap.c | 2 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 56 | ||||
-rw-r--r-- | fs/gfs2/dir.h | 9 | ||||
-rw-r--r-- | fs/gfs2/glock.c | 4 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 4 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 80 | ||||
-rw-r--r-- | fs/gfs2/inode.h | 18 | ||||
-rw-r--r-- | fs/gfs2/meta_io.h | 2 | ||||
-rw-r--r-- | fs/gfs2/ondisk.c | 37 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 4 | ||||
-rw-r--r-- | fs/gfs2/ops_dentry.c | 24 | ||||
-rw-r--r-- | fs/gfs2/ops_export.c | 29 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 4 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 16 | ||||
-rw-r--r-- | fs/gfs2/ops_inode.c | 20 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 6 | ||||
-rw-r--r-- | fs/gfs2/super.c | 2 | ||||
-rw-r--r-- | fs/gfs2/util.c | 4 | ||||
-rw-r--r-- | include/linux/gfs2_ondisk.h | 11 |
19 files changed, 162 insertions, 170 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 1c40c4bbf379..e76a887a89b2 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -1040,7 +1040,7 @@ static int trunc_end(struct gfs2_inode *ip) | |||
1040 | ip->i_di.di_height = 0; | 1040 | ip->i_di.di_height = 0; |
1041 | ip->i_di.di_goal_meta = | 1041 | ip->i_di.di_goal_meta = |
1042 | ip->i_di.di_goal_data = | 1042 | ip->i_di.di_goal_data = |
1043 | ip->i_num.no_addr; | 1043 | ip->i_no_addr; |
1044 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); | 1044 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); |
1045 | } | 1045 | } |
1046 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME_SEC; | 1046 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME_SEC; |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index a96fa07b3f3b..9cdd71cef59c 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1456,7 +1456,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque, | |||
1456 | if (dip->i_di.di_entries != g.offset) { | 1456 | if (dip->i_di.di_entries != g.offset) { |
1457 | fs_warn(sdp, "Number of entries corrupt in dir %llu, " | 1457 | fs_warn(sdp, "Number of entries corrupt in dir %llu, " |
1458 | "ip->i_di.di_entries (%u) != g.offset (%u)\n", | 1458 | "ip->i_di.di_entries (%u) != g.offset (%u)\n", |
1459 | (unsigned long long)dip->i_num.no_addr, | 1459 | (unsigned long long)dip->i_no_addr, |
1460 | dip->i_di.di_entries, | 1460 | dip->i_di.di_entries, |
1461 | g.offset); | 1461 | g.offset); |
1462 | error = -EIO; | 1462 | error = -EIO; |
@@ -1488,24 +1488,54 @@ out: | |||
1488 | * Returns: errno | 1488 | * Returns: errno |
1489 | */ | 1489 | */ |
1490 | 1490 | ||
1491 | int gfs2_dir_search(struct inode *dir, const struct qstr *name, | 1491 | struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name) |
1492 | struct gfs2_inum_host *inum, unsigned int *type) | ||
1493 | { | 1492 | { |
1494 | struct buffer_head *bh; | 1493 | struct buffer_head *bh; |
1495 | struct gfs2_dirent *dent; | 1494 | struct gfs2_dirent *dent; |
1495 | struct inode *inode; | ||
1496 | |||
1497 | dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); | ||
1498 | if (dent) { | ||
1499 | if (IS_ERR(dent)) | ||
1500 | return ERR_PTR(PTR_ERR(dent)); | ||
1501 | inode = gfs2_inode_lookup(dir->i_sb, | ||
1502 | be64_to_cpu(dent->de_inum.no_addr), | ||
1503 | be16_to_cpu(dent->de_type)); | ||
1504 | brelse(bh); | ||
1505 | return inode; | ||
1506 | } | ||
1507 | return ERR_PTR(-ENOENT); | ||
1508 | } | ||
1509 | |||
1510 | int gfs2_dir_check(struct inode *dir, const struct qstr *name, | ||
1511 | const struct gfs2_inode *ip) | ||
1512 | { | ||
1513 | struct buffer_head *bh; | ||
1514 | struct gfs2_dirent *dent; | ||
1515 | int ret = -ENOENT; | ||
1496 | 1516 | ||
1497 | dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); | 1517 | dent = gfs2_dirent_search(dir, name, gfs2_dirent_find, &bh); |
1498 | if (dent) { | 1518 | if (dent) { |
1499 | if (IS_ERR(dent)) | 1519 | if (IS_ERR(dent)) |
1500 | return PTR_ERR(dent); | 1520 | return PTR_ERR(dent); |
1501 | if (inum) | 1521 | if (ip) { |
1502 | gfs2_inum_in(inum, (char *)&dent->de_inum); | 1522 | if (be64_to_cpu(dent->de_inum.no_addr) != ip->i_no_addr) |
1503 | if (type) | 1523 | goto out; |
1504 | *type = be16_to_cpu(dent->de_type); | 1524 | if (be64_to_cpu(dent->de_inum.no_formal_ino) != |
1525 | ip->i_no_formal_ino) | ||
1526 | goto out; | ||
1527 | if (unlikely(IF2DT(ip->i_inode.i_mode) != | ||
1528 | be16_to_cpu(dent->de_type))) { | ||
1529 | gfs2_consist_inode(GFS2_I(dir)); | ||
1530 | ret = -EIO; | ||
1531 | goto out; | ||
1532 | } | ||
1533 | } | ||
1534 | ret = 0; | ||
1535 | out: | ||
1505 | brelse(bh); | 1536 | brelse(bh); |
1506 | return 0; | ||
1507 | } | 1537 | } |
1508 | return -ENOENT; | 1538 | return ret; |
1509 | } | 1539 | } |
1510 | 1540 | ||
1511 | static int dir_new_leaf(struct inode *inode, const struct qstr *name) | 1541 | static int dir_new_leaf(struct inode *inode, const struct qstr *name) |
@@ -1565,7 +1595,7 @@ static int dir_new_leaf(struct inode *inode, const struct qstr *name) | |||
1565 | */ | 1595 | */ |
1566 | 1596 | ||
1567 | int gfs2_dir_add(struct inode *inode, const struct qstr *name, | 1597 | int gfs2_dir_add(struct inode *inode, const struct qstr *name, |
1568 | const struct gfs2_inum_host *inum, unsigned type) | 1598 | const struct gfs2_inode *nip, unsigned type) |
1569 | { | 1599 | { |
1570 | struct gfs2_inode *ip = GFS2_I(inode); | 1600 | struct gfs2_inode *ip = GFS2_I(inode); |
1571 | struct buffer_head *bh; | 1601 | struct buffer_head *bh; |
@@ -1580,7 +1610,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name, | |||
1580 | if (IS_ERR(dent)) | 1610 | if (IS_ERR(dent)) |
1581 | return PTR_ERR(dent); | 1611 | return PTR_ERR(dent); |
1582 | dent = gfs2_init_dirent(inode, dent, name, bh); | 1612 | dent = gfs2_init_dirent(inode, dent, name, bh); |
1583 | gfs2_inum_out(inum, (char *)&dent->de_inum); | 1613 | gfs2_inum_out(nip, dent); |
1584 | dent->de_type = cpu_to_be16(type); | 1614 | dent->de_type = cpu_to_be16(type); |
1585 | if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { | 1615 | if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { |
1586 | leaf = (struct gfs2_leaf *)bh->b_data; | 1616 | leaf = (struct gfs2_leaf *)bh->b_data; |
@@ -1700,7 +1730,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name) | |||
1700 | */ | 1730 | */ |
1701 | 1731 | ||
1702 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, | 1732 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, |
1703 | struct gfs2_inum_host *inum, unsigned int new_type) | 1733 | const struct gfs2_inode *nip, unsigned int new_type) |
1704 | { | 1734 | { |
1705 | struct buffer_head *bh; | 1735 | struct buffer_head *bh; |
1706 | struct gfs2_dirent *dent; | 1736 | struct gfs2_dirent *dent; |
@@ -1715,7 +1745,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, | |||
1715 | return PTR_ERR(dent); | 1745 | return PTR_ERR(dent); |
1716 | 1746 | ||
1717 | gfs2_trans_add_bh(dip->i_gl, bh, 1); | 1747 | gfs2_trans_add_bh(dip->i_gl, bh, 1); |
1718 | gfs2_inum_out(inum, (char *)&dent->de_inum); | 1748 | gfs2_inum_out(nip, dent); |
1719 | dent->de_type = cpu_to_be16(new_type); | 1749 | dent->de_type = cpu_to_be16(new_type); |
1720 | 1750 | ||
1721 | if (dip->i_di.di_flags & GFS2_DIF_EXHASH) { | 1751 | if (dip->i_di.di_flags & GFS2_DIF_EXHASH) { |
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h index 48fe89046bba..8a468cac9328 100644 --- a/fs/gfs2/dir.h +++ b/fs/gfs2/dir.h | |||
@@ -16,15 +16,16 @@ struct inode; | |||
16 | struct gfs2_inode; | 16 | struct gfs2_inode; |
17 | struct gfs2_inum; | 17 | struct gfs2_inum; |
18 | 18 | ||
19 | int gfs2_dir_search(struct inode *dir, const struct qstr *filename, | 19 | struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *filename); |
20 | struct gfs2_inum_host *inum, unsigned int *type); | 20 | int gfs2_dir_check(struct inode *dir, const struct qstr *filename, |
21 | const struct gfs2_inode *ip); | ||
21 | int gfs2_dir_add(struct inode *inode, const struct qstr *filename, | 22 | int gfs2_dir_add(struct inode *inode, const struct qstr *filename, |
22 | const struct gfs2_inum_host *inum, unsigned int type); | 23 | const struct gfs2_inode *ip, unsigned int type); |
23 | int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *filename); | 24 | int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *filename); |
24 | int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque, | 25 | int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque, |
25 | filldir_t filldir); | 26 | filldir_t filldir); |
26 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, | 27 | int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, |
27 | struct gfs2_inum_host *new_inum, unsigned int new_type); | 28 | const struct gfs2_inode *nip, unsigned int new_type); |
28 | 29 | ||
29 | int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip); | 30 | int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip); |
30 | 31 | ||
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index c66c718013ef..b3ed58551e74 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1823,8 +1823,8 @@ static int dump_inode(struct glock_iter *gi, struct gfs2_inode *ip) | |||
1823 | 1823 | ||
1824 | print_dbg(gi, " Inode:\n"); | 1824 | print_dbg(gi, " Inode:\n"); |
1825 | print_dbg(gi, " num = %llu/%llu\n", | 1825 | print_dbg(gi, " num = %llu/%llu\n", |
1826 | (unsigned long long)ip->i_num.no_formal_ino, | 1826 | (unsigned long long)ip->i_no_formal_ino, |
1827 | (unsigned long long)ip->i_num.no_addr); | 1827 | (unsigned long long)ip->i_no_addr); |
1828 | print_dbg(gi, " type = %u\n", IF2DT(ip->i_inode.i_mode)); | 1828 | print_dbg(gi, " type = %u\n", IF2DT(ip->i_inode.i_mode)); |
1829 | print_dbg(gi, " i_flags ="); | 1829 | print_dbg(gi, " i_flags ="); |
1830 | for (x = 0; x < 32; x++) | 1830 | for (x = 0; x < 32; x++) |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index d995441373ab..00c3004a4c22 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -213,8 +213,8 @@ enum { | |||
213 | 213 | ||
214 | struct gfs2_inode { | 214 | struct gfs2_inode { |
215 | struct inode i_inode; | 215 | struct inode i_inode; |
216 | struct gfs2_inum_host i_num; | 216 | u64 i_no_addr; |
217 | 217 | u64 i_no_formal_ino; | |
218 | unsigned long i_flags; /* GIF_... */ | 218 | unsigned long i_flags; /* GIF_... */ |
219 | 219 | ||
220 | struct gfs2_dinode_host i_di; /* To be replaced by ref to block */ | 220 | struct gfs2_dinode_host i_di; /* To be replaced by ref to block */ |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index df0b8b3018b9..58f5a67e1c35 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -41,9 +41,9 @@ | |||
41 | static int iget_test(struct inode *inode, void *opaque) | 41 | static int iget_test(struct inode *inode, void *opaque) |
42 | { | 42 | { |
43 | struct gfs2_inode *ip = GFS2_I(inode); | 43 | struct gfs2_inode *ip = GFS2_I(inode); |
44 | struct gfs2_inum_host *inum = opaque; | 44 | u64 *no_addr = opaque; |
45 | 45 | ||
46 | if (ip->i_num.no_addr == inum->no_addr && | 46 | if (ip->i_no_addr == *no_addr && |
47 | inode->i_private != NULL) | 47 | inode->i_private != NULL) |
48 | return 1; | 48 | return 1; |
49 | 49 | ||
@@ -53,37 +53,37 @@ static int iget_test(struct inode *inode, void *opaque) | |||
53 | static int iget_set(struct inode *inode, void *opaque) | 53 | static int iget_set(struct inode *inode, void *opaque) |
54 | { | 54 | { |
55 | struct gfs2_inode *ip = GFS2_I(inode); | 55 | struct gfs2_inode *ip = GFS2_I(inode); |
56 | struct gfs2_inum_host *inum = opaque; | 56 | u64 *no_addr = opaque; |
57 | 57 | ||
58 | ip->i_num = *inum; | 58 | inode->i_ino = (unsigned long)*no_addr; |
59 | inode->i_ino = inum->no_addr; | 59 | ip->i_no_addr = *no_addr; |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum) | 63 | struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr) |
64 | { | 64 | { |
65 | return ilookup5(sb, (unsigned long)inum->no_addr, | 65 | unsigned long hash = (unsigned long)no_addr; |
66 | iget_test, inum); | 66 | return ilookup5(sb, hash, iget_test, &no_addr); |
67 | } | 67 | } |
68 | 68 | ||
69 | static struct inode *gfs2_iget(struct super_block *sb, struct gfs2_inum_host *inum) | 69 | static struct inode *gfs2_iget(struct super_block *sb, u64 no_addr) |
70 | { | 70 | { |
71 | return iget5_locked(sb, (unsigned long)inum->no_addr, | 71 | unsigned long hash = (unsigned long)no_addr; |
72 | iget_test, iget_set, inum); | 72 | return iget5_locked(sb, hash, iget_test, iget_set, &no_addr); |
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * gfs2_inode_lookup - Lookup an inode | 76 | * gfs2_inode_lookup - Lookup an inode |
77 | * @sb: The super block | 77 | * @sb: The super block |
78 | * @inum: The inode number | 78 | * @no_addr: The inode number |
79 | * @type: The type of the inode | 79 | * @type: The type of the inode |
80 | * | 80 | * |
81 | * Returns: A VFS inode, or an error | 81 | * Returns: A VFS inode, or an error |
82 | */ | 82 | */ |
83 | 83 | ||
84 | struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned int type) | 84 | struct inode *gfs2_inode_lookup(struct super_block *sb, u64 no_addr, unsigned int type) |
85 | { | 85 | { |
86 | struct inode *inode = gfs2_iget(sb, inum); | 86 | struct inode *inode = gfs2_iget(sb, no_addr); |
87 | struct gfs2_inode *ip = GFS2_I(inode); | 87 | struct gfs2_inode *ip = GFS2_I(inode); |
88 | struct gfs2_glock *io_gl; | 88 | struct gfs2_glock *io_gl; |
89 | int error; | 89 | int error; |
@@ -110,12 +110,12 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *i | |||
110 | inode->i_op = &gfs2_dev_iops; | 110 | inode->i_op = &gfs2_dev_iops; |
111 | } | 111 | } |
112 | 112 | ||
113 | error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); | 113 | error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); |
114 | if (unlikely(error)) | 114 | if (unlikely(error)) |
115 | goto fail; | 115 | goto fail; |
116 | ip->i_gl->gl_object = ip; | 116 | ip->i_gl->gl_object = ip; |
117 | 117 | ||
118 | error = gfs2_glock_get(sdp, inum->no_addr, &gfs2_iopen_glops, CREATE, &io_gl); | 118 | error = gfs2_glock_get(sdp, no_addr, &gfs2_iopen_glops, CREATE, &io_gl); |
119 | if (unlikely(error)) | 119 | if (unlikely(error)) |
120 | goto fail_put; | 120 | goto fail_put; |
121 | 121 | ||
@@ -144,14 +144,12 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
144 | struct gfs2_dinode_host *di = &ip->i_di; | 144 | struct gfs2_dinode_host *di = &ip->i_di; |
145 | const struct gfs2_dinode *str = buf; | 145 | const struct gfs2_dinode *str = buf; |
146 | 146 | ||
147 | if (ip->i_num.no_addr != be64_to_cpu(str->di_num.no_addr)) { | 147 | if (ip->i_no_addr != be64_to_cpu(str->di_num.no_addr)) { |
148 | if (gfs2_consist_inode(ip)) | 148 | if (gfs2_consist_inode(ip)) |
149 | gfs2_dinode_print(ip); | 149 | gfs2_dinode_print(ip); |
150 | return -EIO; | 150 | return -EIO; |
151 | } | 151 | } |
152 | if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) | 152 | ip->i_no_formal_ino = be64_to_cpu(str->di_num.no_formal_ino); |
153 | return -ESTALE; | ||
154 | |||
155 | ip->i_inode.i_mode = be32_to_cpu(str->di_mode); | 153 | ip->i_inode.i_mode = be32_to_cpu(str->di_mode); |
156 | ip->i_inode.i_rdev = 0; | 154 | ip->i_inode.i_rdev = 0; |
157 | switch (ip->i_inode.i_mode & S_IFMT) { | 155 | switch (ip->i_inode.i_mode & S_IFMT) { |
@@ -247,7 +245,7 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip) | |||
247 | if (error) | 245 | if (error) |
248 | goto out_qs; | 246 | goto out_qs; |
249 | 247 | ||
250 | rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); | 248 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
251 | if (!rgd) { | 249 | if (!rgd) { |
252 | gfs2_consist_inode(ip); | 250 | gfs2_consist_inode(ip); |
253 | error = -EIO; | 251 | error = -EIO; |
@@ -366,8 +364,6 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, | |||
366 | struct super_block *sb = dir->i_sb; | 364 | struct super_block *sb = dir->i_sb; |
367 | struct gfs2_inode *dip = GFS2_I(dir); | 365 | struct gfs2_inode *dip = GFS2_I(dir); |
368 | struct gfs2_holder d_gh; | 366 | struct gfs2_holder d_gh; |
369 | struct gfs2_inum_host inum; | ||
370 | unsigned int type; | ||
371 | int error; | 367 | int error; |
372 | struct inode *inode = NULL; | 368 | struct inode *inode = NULL; |
373 | int unlock = 0; | 369 | int unlock = 0; |
@@ -395,12 +391,9 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name, | |||
395 | goto out; | 391 | goto out; |
396 | } | 392 | } |
397 | 393 | ||
398 | error = gfs2_dir_search(dir, name, &inum, &type); | 394 | inode = gfs2_dir_search(dir, name); |
399 | if (error) | 395 | if (IS_ERR(inode)) |
400 | goto out; | 396 | error = PTR_ERR(inode); |
401 | |||
402 | inode = gfs2_inode_lookup(sb, &inum, type); | ||
403 | |||
404 | out: | 397 | out: |
405 | if (unlock) | 398 | if (unlock) |
406 | gfs2_glock_dq_uninit(&d_gh); | 399 | gfs2_glock_dq_uninit(&d_gh); |
@@ -548,7 +541,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
548 | if (!dip->i_inode.i_nlink) | 541 | if (!dip->i_inode.i_nlink) |
549 | return -EPERM; | 542 | return -EPERM; |
550 | 543 | ||
551 | error = gfs2_dir_search(&dip->i_inode, name, NULL, NULL); | 544 | error = gfs2_dir_check(&dip->i_inode, name, NULL); |
552 | switch (error) { | 545 | switch (error) { |
553 | case -ENOENT: | 546 | case -ENOENT: |
554 | error = 0; | 547 | error = 0; |
@@ -588,8 +581,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | |||
588 | *gid = current->fsgid; | 581 | *gid = current->fsgid; |
589 | } | 582 | } |
590 | 583 | ||
591 | static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum, | 584 | static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation) |
592 | u64 *generation) | ||
593 | { | 585 | { |
594 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 586 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
595 | int error; | 587 | int error; |
@@ -605,7 +597,7 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum_host *inum, | |||
605 | if (error) | 597 | if (error) |
606 | goto out_ipreserv; | 598 | goto out_ipreserv; |
607 | 599 | ||
608 | inum->no_addr = gfs2_alloc_di(dip, generation); | 600 | *no_addr = gfs2_alloc_di(dip, generation); |
609 | 601 | ||
610 | gfs2_trans_end(sdp); | 602 | gfs2_trans_end(sdp); |
611 | 603 | ||
@@ -760,7 +752,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, | |||
760 | goto fail_quota_locks; | 752 | goto fail_quota_locks; |
761 | } | 753 | } |
762 | 754 | ||
763 | error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode)); | 755 | error = gfs2_dir_add(&dip->i_inode, name, ip, IF2DT(ip->i_inode.i_mode)); |
764 | if (error) | 756 | if (error) |
765 | goto fail_end_trans; | 757 | goto fail_end_trans; |
766 | 758 | ||
@@ -844,7 +836,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
844 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; | 836 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; |
845 | struct inode *dir = &dip->i_inode; | 837 | struct inode *dir = &dip->i_inode; |
846 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 838 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
847 | struct gfs2_inum_host inum; | 839 | struct gfs2_inum_host inum = { .no_addr = 0, .no_formal_ino = 0 }; |
848 | int error; | 840 | int error; |
849 | u64 generation; | 841 | u64 generation; |
850 | 842 | ||
@@ -864,7 +856,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
864 | if (error) | 856 | if (error) |
865 | goto fail_gunlock; | 857 | goto fail_gunlock; |
866 | 858 | ||
867 | error = alloc_dinode(dip, &inum, &generation); | 859 | error = alloc_dinode(dip, &inum.no_addr, &generation); |
868 | if (error) | 860 | if (error) |
869 | goto fail_gunlock; | 861 | goto fail_gunlock; |
870 | 862 | ||
@@ -877,7 +869,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
877 | if (error) | 869 | if (error) |
878 | goto fail_gunlock2; | 870 | goto fail_gunlock2; |
879 | 871 | ||
880 | inode = gfs2_inode_lookup(dir->i_sb, &inum, IF2DT(mode)); | 872 | inode = gfs2_inode_lookup(dir->i_sb, inum.no_addr, IF2DT(mode)); |
881 | if (IS_ERR(inode)) | 873 | if (IS_ERR(inode)) |
882 | goto fail_gunlock2; | 874 | goto fail_gunlock2; |
883 | 875 | ||
@@ -976,10 +968,8 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | |||
976 | */ | 968 | */ |
977 | 969 | ||
978 | int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | 970 | int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, |
979 | struct gfs2_inode *ip) | 971 | const struct gfs2_inode *ip) |
980 | { | 972 | { |
981 | struct gfs2_inum_host inum; | ||
982 | unsigned int type; | ||
983 | int error; | 973 | int error; |
984 | 974 | ||
985 | if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) | 975 | if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) |
@@ -997,18 +987,10 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
997 | if (error) | 987 | if (error) |
998 | return error; | 988 | return error; |
999 | 989 | ||
1000 | error = gfs2_dir_search(&dip->i_inode, name, &inum, &type); | 990 | error = gfs2_dir_check(&dip->i_inode, name, ip); |
1001 | if (error) | 991 | if (error) |
1002 | return error; | 992 | return error; |
1003 | 993 | ||
1004 | if (!gfs2_inum_equal(&inum, &ip->i_num)) | ||
1005 | return -ENOENT; | ||
1006 | |||
1007 | if (IF2DT(ip->i_inode.i_mode) != type) { | ||
1008 | gfs2_consist_inode(dip); | ||
1009 | return -EIO; | ||
1010 | } | ||
1011 | |||
1012 | return 0; | 994 | return 0; |
1013 | } | 995 | } |
1014 | 996 | ||
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h index b57f448b15bc..05fc095d8540 100644 --- a/fs/gfs2/inode.h +++ b/fs/gfs2/inode.h | |||
@@ -10,17 +10,17 @@ | |||
10 | #ifndef __INODE_DOT_H__ | 10 | #ifndef __INODE_DOT_H__ |
11 | #define __INODE_DOT_H__ | 11 | #define __INODE_DOT_H__ |
12 | 12 | ||
13 | static inline int gfs2_is_stuffed(struct gfs2_inode *ip) | 13 | static inline int gfs2_is_stuffed(const struct gfs2_inode *ip) |
14 | { | 14 | { |
15 | return !ip->i_di.di_height; | 15 | return !ip->i_di.di_height; |
16 | } | 16 | } |
17 | 17 | ||
18 | static inline int gfs2_is_jdata(struct gfs2_inode *ip) | 18 | static inline int gfs2_is_jdata(const struct gfs2_inode *ip) |
19 | { | 19 | { |
20 | return ip->i_di.di_flags & GFS2_DIF_JDATA; | 20 | return ip->i_di.di_flags & GFS2_DIF_JDATA; |
21 | } | 21 | } |
22 | 22 | ||
23 | static inline int gfs2_is_dir(struct gfs2_inode *ip) | 23 | static inline int gfs2_is_dir(const struct gfs2_inode *ip) |
24 | { | 24 | { |
25 | return S_ISDIR(ip->i_inode.i_mode); | 25 | return S_ISDIR(ip->i_inode.i_mode); |
26 | } | 26 | } |
@@ -32,9 +32,15 @@ static inline void gfs2_set_inode_blocks(struct inode *inode) | |||
32 | (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); | 32 | (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline int gfs2_check_inum(const struct gfs2_inode *ip, u64 no_addr, | ||
36 | u64 no_formal_ino) | ||
37 | { | ||
38 | return ip->i_no_addr == no_addr && ip->i_no_formal_ino == no_formal_ino; | ||
39 | } | ||
40 | |||
35 | void gfs2_inode_attr_in(struct gfs2_inode *ip); | 41 | void gfs2_inode_attr_in(struct gfs2_inode *ip); |
36 | struct inode *gfs2_inode_lookup(struct super_block *sb, struct gfs2_inum_host *inum, unsigned type); | 42 | struct inode *gfs2_inode_lookup(struct super_block *sb, u64 no_addr, unsigned type); |
37 | struct inode *gfs2_ilookup(struct super_block *sb, struct gfs2_inum_host *inum); | 43 | struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr); |
38 | 44 | ||
39 | int gfs2_inode_refresh(struct gfs2_inode *ip); | 45 | int gfs2_inode_refresh(struct gfs2_inode *ip); |
40 | 46 | ||
@@ -47,7 +53,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
47 | int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | 53 | int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, |
48 | struct gfs2_inode *ip); | 54 | struct gfs2_inode *ip); |
49 | int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | 55 | int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, |
50 | struct gfs2_inode *ip); | 56 | const struct gfs2_inode *ip); |
51 | int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to); | 57 | int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to); |
52 | int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len); | 58 | int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len); |
53 | int gfs2_glock_nq_atime(struct gfs2_holder *gh); | 59 | int gfs2_glock_nq_atime(struct gfs2_holder *gh); |
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h index e037425bc042..527bf19d9690 100644 --- a/fs/gfs2/meta_io.h +++ b/fs/gfs2/meta_io.h | |||
@@ -63,7 +63,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, | |||
63 | static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip, | 63 | static inline int gfs2_meta_inode_buffer(struct gfs2_inode *ip, |
64 | struct buffer_head **bhp) | 64 | struct buffer_head **bhp) |
65 | { | 65 | { |
66 | return gfs2_meta_indirect_buffer(ip, 0, ip->i_num.no_addr, 0, bhp); | 66 | return gfs2_meta_indirect_buffer(ip, 0, ip->i_no_addr, 0, bhp); |
67 | } | 67 | } |
68 | 68 | ||
69 | struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen); | 69 | struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen); |
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c index d9ecfd23a49e..cd4cf055c37d 100644 --- a/fs/gfs2/ondisk.c +++ b/fs/gfs2/ondisk.c | |||
@@ -33,26 +33,10 @@ | |||
33 | * first arg: the cpu-order structure | 33 | * first arg: the cpu-order structure |
34 | */ | 34 | */ |
35 | 35 | ||
36 | void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf) | 36 | void gfs2_inum_out(const struct gfs2_inode *ip, struct gfs2_dirent *dent) |
37 | { | 37 | { |
38 | const struct gfs2_inum *str = buf; | 38 | dent->de_inum.no_formal_ino = cpu_to_be64(ip->i_no_formal_ino); |
39 | 39 | dent->de_inum.no_addr = cpu_to_be64(ip->i_no_addr); | |
40 | no->no_formal_ino = be64_to_cpu(str->no_formal_ino); | ||
41 | no->no_addr = be64_to_cpu(str->no_addr); | ||
42 | } | ||
43 | |||
44 | void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf) | ||
45 | { | ||
46 | struct gfs2_inum *str = buf; | ||
47 | |||
48 | str->no_formal_ino = cpu_to_be64(no->no_formal_ino); | ||
49 | str->no_addr = cpu_to_be64(no->no_addr); | ||
50 | } | ||
51 | |||
52 | static void gfs2_inum_print(const struct gfs2_inum_host *no) | ||
53 | { | ||
54 | printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)no->no_formal_ino); | ||
55 | printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)no->no_addr); | ||
56 | } | 40 | } |
57 | 41 | ||
58 | static void gfs2_meta_header_in(struct gfs2_meta_header_host *mh, const void *buf) | 42 | static void gfs2_meta_header_in(struct gfs2_meta_header_host *mh, const void *buf) |
@@ -74,9 +58,10 @@ void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) | |||
74 | sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); | 58 | sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); |
75 | sb->sb_bsize = be32_to_cpu(str->sb_bsize); | 59 | sb->sb_bsize = be32_to_cpu(str->sb_bsize); |
76 | sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); | 60 | sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); |
77 | 61 | sb->sb_master_dir.no_addr = be64_to_cpu(str->sb_master_dir.no_addr); | |
78 | gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir); | 62 | sb->sb_master_dir.no_formal_ino = be64_to_cpu(str->sb_master_dir.no_formal_ino); |
79 | gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir); | 63 | sb->sb_root_dir.no_addr = be64_to_cpu(str->sb_root_dir.no_addr); |
64 | sb->sb_root_dir.no_formal_ino = be64_to_cpu(str->sb_root_dir.no_formal_ino); | ||
80 | 65 | ||
81 | memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); | 66 | memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); |
82 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); | 67 | memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); |
@@ -146,9 +131,8 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) | |||
146 | str->di_header.__pad0 = 0; | 131 | str->di_header.__pad0 = 0; |
147 | str->di_header.mh_format = cpu_to_be32(GFS2_FORMAT_DI); | 132 | str->di_header.mh_format = cpu_to_be32(GFS2_FORMAT_DI); |
148 | str->di_header.__pad1 = 0; | 133 | str->di_header.__pad1 = 0; |
149 | 134 | str->di_num.no_addr = cpu_to_be64(ip->i_no_addr); | |
150 | gfs2_inum_out(&ip->i_num, &str->di_num); | 135 | str->di_num.no_formal_ino = cpu_to_be64(ip->i_no_formal_ino); |
151 | |||
152 | str->di_mode = cpu_to_be32(ip->i_inode.i_mode); | 136 | str->di_mode = cpu_to_be32(ip->i_inode.i_mode); |
153 | str->di_uid = cpu_to_be32(ip->i_inode.i_uid); | 137 | str->di_uid = cpu_to_be32(ip->i_inode.i_uid); |
154 | str->di_gid = cpu_to_be32(ip->i_inode.i_gid); | 138 | str->di_gid = cpu_to_be32(ip->i_inode.i_gid); |
@@ -178,7 +162,8 @@ void gfs2_dinode_print(const struct gfs2_inode *ip) | |||
178 | { | 162 | { |
179 | const struct gfs2_dinode_host *di = &ip->i_di; | 163 | const struct gfs2_dinode_host *di = &ip->i_di; |
180 | 164 | ||
181 | gfs2_inum_print(&ip->i_num); | 165 | printk(KERN_INFO " no_formal_ino = %llu\n", (unsigned long long)ip->i_no_formal_ino); |
166 | printk(KERN_INFO " no_addr = %llu\n", (unsigned long long)ip->i_no_addr); | ||
182 | 167 | ||
183 | printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); | 168 | printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); |
184 | printk(KERN_INFO " di_blocks = %llu\n", (unsigned long long)di->di_blocks); | 169 | printk(KERN_INFO " di_blocks = %llu\n", (unsigned long long)di->di_blocks); |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 4913ef57b095..fb84478e1df6 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -757,8 +757,8 @@ static unsigned limit = 0; | |||
757 | return; | 757 | return; |
758 | 758 | ||
759 | fs_warn(sdp, "ip = %llu %llu\n", | 759 | fs_warn(sdp, "ip = %llu %llu\n", |
760 | (unsigned long long)ip->i_num.no_formal_ino, | 760 | (unsigned long long)ip->i_no_formal_ino, |
761 | (unsigned long long)ip->i_num.no_addr); | 761 | (unsigned long long)ip->i_no_addr); |
762 | 762 | ||
763 | for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) | 763 | for (x = 0; x < GFS2_MAX_META_HEIGHT; x++) |
764 | fs_warn(sdp, "ip->i_cache[%u] = %s\n", | 764 | fs_warn(sdp, "ip->i_cache[%u] = %s\n", |
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c index a6fdc52f554a..793e334d098e 100644 --- a/fs/gfs2/ops_dentry.c +++ b/fs/gfs2/ops_dentry.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "glock.h" | 21 | #include "glock.h" |
22 | #include "ops_dentry.h" | 22 | #include "ops_dentry.h" |
23 | #include "util.h" | 23 | #include "util.h" |
24 | #include "inode.h" | ||
24 | 25 | ||
25 | /** | 26 | /** |
26 | * gfs2_drevalidate - Check directory lookup consistency | 27 | * gfs2_drevalidate - Check directory lookup consistency |
@@ -40,14 +41,15 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) | |||
40 | struct gfs2_inode *dip = GFS2_I(parent->d_inode); | 41 | struct gfs2_inode *dip = GFS2_I(parent->d_inode); |
41 | struct inode *inode = dentry->d_inode; | 42 | struct inode *inode = dentry->d_inode; |
42 | struct gfs2_holder d_gh; | 43 | struct gfs2_holder d_gh; |
43 | struct gfs2_inode *ip; | 44 | struct gfs2_inode *ip = NULL; |
44 | struct gfs2_inum_host inum; | ||
45 | unsigned int type; | ||
46 | int error; | 45 | int error; |
47 | int had_lock=0; | 46 | int had_lock=0; |
48 | 47 | ||
49 | if (inode && is_bad_inode(inode)) | 48 | if (inode) { |
50 | goto invalid; | 49 | if (is_bad_inode(inode)) |
50 | goto invalid; | ||
51 | ip = GFS2_I(inode); | ||
52 | } | ||
51 | 53 | ||
52 | if (sdp->sd_args.ar_localcaching) | 54 | if (sdp->sd_args.ar_localcaching) |
53 | goto valid; | 55 | goto valid; |
@@ -59,7 +61,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) | |||
59 | goto fail; | 61 | goto fail; |
60 | } | 62 | } |
61 | 63 | ||
62 | error = gfs2_dir_search(parent->d_inode, &dentry->d_name, &inum, &type); | 64 | error = gfs2_dir_check(parent->d_inode, &dentry->d_name, ip); |
63 | switch (error) { | 65 | switch (error) { |
64 | case 0: | 66 | case 0: |
65 | if (!inode) | 67 | if (!inode) |
@@ -73,16 +75,6 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) | |||
73 | goto fail_gunlock; | 75 | goto fail_gunlock; |
74 | } | 76 | } |
75 | 77 | ||
76 | ip = GFS2_I(inode); | ||
77 | |||
78 | if (!gfs2_inum_equal(&ip->i_num, &inum)) | ||
79 | goto invalid_gunlock; | ||
80 | |||
81 | if (IF2DT(ip->i_inode.i_mode) != type) { | ||
82 | gfs2_consist_inode(dip); | ||
83 | goto fail_gunlock; | ||
84 | } | ||
85 | |||
86 | valid_gunlock: | 78 | valid_gunlock: |
87 | if (!had_lock) | 79 | if (!had_lock) |
88 | gfs2_glock_dq_uninit(&d_gh); | 80 | gfs2_glock_dq_uninit(&d_gh); |
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index aad918337a46..51a8a14deb29 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -75,10 +75,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
75 | (connectable && *len < GFS2_LARGE_FH_SIZE)) | 75 | (connectable && *len < GFS2_LARGE_FH_SIZE)) |
76 | return 255; | 76 | return 255; |
77 | 77 | ||
78 | fh[0] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); | 78 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
79 | fh[1] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); | 79 | fh[1] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
80 | fh[2] = cpu_to_be32(ip->i_num.no_addr >> 32); | 80 | fh[2] = cpu_to_be32(ip->i_no_addr >> 32); |
81 | fh[3] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); | 81 | fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
82 | *len = GFS2_SMALL_FH_SIZE; | 82 | *len = GFS2_SMALL_FH_SIZE; |
83 | 83 | ||
84 | if (!connectable || inode == sb->s_root->d_inode) | 84 | if (!connectable || inode == sb->s_root->d_inode) |
@@ -90,10 +90,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
90 | igrab(inode); | 90 | igrab(inode); |
91 | spin_unlock(&dentry->d_lock); | 91 | spin_unlock(&dentry->d_lock); |
92 | 92 | ||
93 | fh[4] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); | 93 | fh[4] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
94 | fh[5] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); | 94 | fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
95 | fh[6] = cpu_to_be32(ip->i_num.no_addr >> 32); | 95 | fh[6] = cpu_to_be32(ip->i_no_addr >> 32); |
96 | fh[7] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); | 96 | fh[7] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
97 | 97 | ||
98 | fh[8] = cpu_to_be32(inode->i_mode); | 98 | fh[8] = cpu_to_be32(inode->i_mode); |
99 | fh[9] = 0; /* pad to double word */ | 99 | fh[9] = 0; /* pad to double word */ |
@@ -144,7 +144,8 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
144 | ip = GFS2_I(inode); | 144 | ip = GFS2_I(inode); |
145 | 145 | ||
146 | *name = 0; | 146 | *name = 0; |
147 | gnfd.inum = ip->i_num; | 147 | gnfd.inum.no_addr = ip->i_no_addr; |
148 | gnfd.inum.no_formal_ino = ip->i_no_formal_ino; | ||
148 | gnfd.name = name; | 149 | gnfd.name = name; |
149 | 150 | ||
150 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); | 151 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); |
@@ -202,9 +203,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
202 | 203 | ||
203 | /* System files? */ | 204 | /* System files? */ |
204 | 205 | ||
205 | inode = gfs2_ilookup(sb, inum); | 206 | inode = gfs2_ilookup(sb, inum->no_addr); |
206 | if (inode) { | 207 | if (inode) { |
207 | if (GFS2_I(inode)->i_num.no_formal_ino != inum->no_formal_ino) { | 208 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { |
208 | iput(inode); | 209 | iput(inode); |
209 | return ERR_PTR(-ESTALE); | 210 | return ERR_PTR(-ESTALE); |
210 | } | 211 | } |
@@ -236,7 +237,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
236 | gfs2_glock_dq_uninit(&rgd_gh); | 237 | gfs2_glock_dq_uninit(&rgd_gh); |
237 | gfs2_glock_dq_uninit(&ri_gh); | 238 | gfs2_glock_dq_uninit(&ri_gh); |
238 | 239 | ||
239 | inode = gfs2_inode_lookup(sb, inum, fh_obj->imode); | 240 | inode = gfs2_inode_lookup(sb, inum->no_addr, fh_obj->imode); |
240 | if (!inode) | 241 | if (!inode) |
241 | goto fail; | 242 | goto fail; |
242 | if (IS_ERR(inode)) { | 243 | if (IS_ERR(inode)) { |
@@ -249,6 +250,10 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
249 | iput(inode); | 250 | iput(inode); |
250 | goto fail; | 251 | goto fail; |
251 | } | 252 | } |
253 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { | ||
254 | iput(inode); | ||
255 | goto fail; | ||
256 | } | ||
252 | 257 | ||
253 | error = -EIO; | 258 | error = -EIO; |
254 | if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) { | 259 | if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) { |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index 064df8804582..550032c3b5f7 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -502,7 +502,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) | |||
502 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); | 502 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
503 | struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); | 503 | struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host); |
504 | struct lm_lockname name = | 504 | struct lm_lockname name = |
505 | { .ln_number = ip->i_num.no_addr, | 505 | { .ln_number = ip->i_no_addr, |
506 | .ln_type = LM_TYPE_PLOCK }; | 506 | .ln_type = LM_TYPE_PLOCK }; |
507 | 507 | ||
508 | if (!(fl->fl_flags & FL_POSIX)) | 508 | if (!(fl->fl_flags & FL_POSIX)) |
@@ -557,7 +557,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
557 | gfs2_glock_dq_uninit(fl_gh); | 557 | gfs2_glock_dq_uninit(fl_gh); |
558 | } else { | 558 | } else { |
559 | error = gfs2_glock_get(GFS2_SB(&ip->i_inode), | 559 | error = gfs2_glock_get(GFS2_SB(&ip->i_inode), |
560 | ip->i_num.no_addr, &gfs2_flock_glops, | 560 | ip->i_no_addr, &gfs2_flock_glops, |
561 | CREATE, &gl); | 561 | CREATE, &gl); |
562 | if (error) | 562 | if (error) |
563 | goto out; | 563 | goto out; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 2c5f8e7def0d..c682371717ff 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -236,17 +236,17 @@ fail: | |||
236 | return error; | 236 | return error; |
237 | } | 237 | } |
238 | 238 | ||
239 | static struct inode *gfs2_lookup_root(struct super_block *sb, | 239 | static inline struct inode *gfs2_lookup_root(struct super_block *sb, |
240 | struct gfs2_inum_host *inum) | 240 | u64 no_addr) |
241 | { | 241 | { |
242 | return gfs2_inode_lookup(sb, inum, DT_DIR); | 242 | return gfs2_inode_lookup(sb, no_addr, DT_DIR); |
243 | } | 243 | } |
244 | 244 | ||
245 | static int init_sb(struct gfs2_sbd *sdp, int silent, int undo) | 245 | static int init_sb(struct gfs2_sbd *sdp, int silent, int undo) |
246 | { | 246 | { |
247 | struct super_block *sb = sdp->sd_vfs; | 247 | struct super_block *sb = sdp->sd_vfs; |
248 | struct gfs2_holder sb_gh; | 248 | struct gfs2_holder sb_gh; |
249 | struct gfs2_inum_host *inum; | 249 | u64 no_addr; |
250 | struct inode *inode; | 250 | struct inode *inode; |
251 | int error = 0; | 251 | int error = 0; |
252 | 252 | ||
@@ -289,10 +289,10 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo) | |||
289 | sb_set_blocksize(sb, sdp->sd_sb.sb_bsize); | 289 | sb_set_blocksize(sb, sdp->sd_sb.sb_bsize); |
290 | 290 | ||
291 | /* Get the root inode */ | 291 | /* Get the root inode */ |
292 | inum = &sdp->sd_sb.sb_root_dir; | 292 | no_addr = sdp->sd_sb.sb_root_dir.no_addr; |
293 | if (sb->s_type == &gfs2meta_fs_type) | 293 | if (sb->s_type == &gfs2meta_fs_type) |
294 | inum = &sdp->sd_sb.sb_master_dir; | 294 | no_addr = sdp->sd_sb.sb_master_dir.no_addr; |
295 | inode = gfs2_lookup_root(sb, inum); | 295 | inode = gfs2_lookup_root(sb, no_addr); |
296 | if (IS_ERR(inode)) { | 296 | if (IS_ERR(inode)) { |
297 | error = PTR_ERR(inode); | 297 | error = PTR_ERR(inode); |
298 | fs_err(sdp, "can't read in root inode: %d\n", error); | 298 | fs_err(sdp, "can't read in root inode: %d\n", error); |
@@ -449,7 +449,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) | |||
449 | if (undo) | 449 | if (undo) |
450 | goto fail_qinode; | 450 | goto fail_qinode; |
451 | 451 | ||
452 | inode = gfs2_lookup_root(sdp->sd_vfs, &sdp->sd_sb.sb_master_dir); | 452 | inode = gfs2_lookup_root(sdp->sd_vfs, sdp->sd_sb.sb_master_dir.no_addr); |
453 | if (IS_ERR(inode)) { | 453 | if (IS_ERR(inode)) { |
454 | error = PTR_ERR(inode); | 454 | error = PTR_ERR(inode); |
455 | fs_err(sdp, "can't read in master directory: %d\n", error); | 455 | fs_err(sdp, "can't read in master directory: %d\n", error); |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index d85f6e05cb95..f8ecfec4064b 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -157,7 +157,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
157 | if (error) | 157 | if (error) |
158 | goto out_gunlock; | 158 | goto out_gunlock; |
159 | 159 | ||
160 | error = gfs2_dir_search(dir, &dentry->d_name, NULL, NULL); | 160 | error = gfs2_dir_check(dir, &dentry->d_name, NULL); |
161 | switch (error) { | 161 | switch (error) { |
162 | case -ENOENT: | 162 | case -ENOENT: |
163 | break; | 163 | break; |
@@ -217,8 +217,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
217 | goto out_ipres; | 217 | goto out_ipres; |
218 | } | 218 | } |
219 | 219 | ||
220 | error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num, | 220 | error = gfs2_dir_add(dir, &dentry->d_name, ip, IF2DT(inode->i_mode)); |
221 | IF2DT(inode->i_mode)); | ||
222 | if (error) | 221 | if (error) |
223 | goto out_end_trans; | 222 | goto out_end_trans; |
224 | 223 | ||
@@ -275,7 +274,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) | |||
275 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 274 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
276 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 275 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
277 | 276 | ||
278 | rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); | 277 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
279 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 278 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); |
280 | 279 | ||
281 | 280 | ||
@@ -420,7 +419,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
420 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); | 419 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); |
421 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); | 420 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); |
422 | 421 | ||
423 | gfs2_inum_out(&dip->i_num, &dent->de_inum); | 422 | gfs2_inum_out(dip, dent); |
424 | dent->de_type = cpu_to_be16(DT_DIR); | 423 | dent->de_type = cpu_to_be16(DT_DIR); |
425 | 424 | ||
426 | gfs2_dinode_out(ip, di); | 425 | gfs2_dinode_out(ip, di); |
@@ -472,7 +471,7 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) | |||
472 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 471 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
473 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 472 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
474 | 473 | ||
475 | rgd = gfs2_blk2rgrpd(sdp, ip->i_num.no_addr); | 474 | rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); |
476 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); | 475 | gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); |
477 | 476 | ||
478 | error = gfs2_glock_nq_m(3, ghs); | 477 | error = gfs2_glock_nq_m(3, ghs); |
@@ -614,7 +613,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
614 | * this is the case of the target file already existing | 613 | * this is the case of the target file already existing |
615 | * so we unlink before doing the rename | 614 | * so we unlink before doing the rename |
616 | */ | 615 | */ |
617 | nrgd = gfs2_blk2rgrpd(sdp, nip->i_num.no_addr); | 616 | nrgd = gfs2_blk2rgrpd(sdp, nip->i_no_addr); |
618 | if (nrgd) | 617 | if (nrgd) |
619 | gfs2_holder_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++); | 618 | gfs2_holder_init(nrgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++); |
620 | } | 619 | } |
@@ -653,7 +652,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
653 | if (error) | 652 | if (error) |
654 | goto out_gunlock; | 653 | goto out_gunlock; |
655 | 654 | ||
656 | error = gfs2_dir_search(ndir, &ndentry->d_name, NULL, NULL); | 655 | error = gfs2_dir_check(ndir, &ndentry->d_name, NULL); |
657 | switch (error) { | 656 | switch (error) { |
658 | case -ENOENT: | 657 | case -ENOENT: |
659 | error = 0; | 658 | error = 0; |
@@ -750,7 +749,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
750 | if (error) | 749 | if (error) |
751 | goto out_end_trans; | 750 | goto out_end_trans; |
752 | 751 | ||
753 | error = gfs2_dir_mvino(ip, &name, &ndip->i_num, DT_DIR); | 752 | error = gfs2_dir_mvino(ip, &name, nip, DT_DIR); |
754 | if (error) | 753 | if (error) |
755 | goto out_end_trans; | 754 | goto out_end_trans; |
756 | } else { | 755 | } else { |
@@ -768,8 +767,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
768 | if (error) | 767 | if (error) |
769 | goto out_end_trans; | 768 | goto out_end_trans; |
770 | 769 | ||
771 | error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num, | 770 | error = gfs2_dir_add(ndir, &ndentry->d_name, ip, IF2DT(ip->i_inode.i_mode)); |
772 | IF2DT(ip->i_inode.i_mode)); | ||
773 | if (error) | 771 | if (error) |
774 | goto out_end_trans; | 772 | goto out_end_trans; |
775 | 773 | ||
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index a62c0f2d26d3..30eb428065c5 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1470,7 +1470,7 @@ void gfs2_unlink_di(struct inode *inode) | |||
1470 | struct gfs2_inode *ip = GFS2_I(inode); | 1470 | struct gfs2_inode *ip = GFS2_I(inode); |
1471 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 1471 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
1472 | struct gfs2_rgrpd *rgd; | 1472 | struct gfs2_rgrpd *rgd; |
1473 | u64 blkno = ip->i_num.no_addr; | 1473 | u64 blkno = ip->i_no_addr; |
1474 | 1474 | ||
1475 | rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED); | 1475 | rgd = rgblk_free(sdp, blkno, 1, GFS2_BLKST_UNLINKED); |
1476 | if (!rgd) | 1476 | if (!rgd) |
@@ -1505,9 +1505,9 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno) | |||
1505 | 1505 | ||
1506 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) | 1506 | void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) |
1507 | { | 1507 | { |
1508 | gfs2_free_uninit_di(rgd, ip->i_num.no_addr); | 1508 | gfs2_free_uninit_di(rgd, ip->i_no_addr); |
1509 | gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1509 | gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1510 | gfs2_meta_wipe(ip, ip->i_num.no_addr, 1); | 1510 | gfs2_meta_wipe(ip, ip->i_no_addr, 1); |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | /** | 1513 | /** |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 4fdda974dc83..faccffd19907 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -360,7 +360,7 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh) | |||
360 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); | 360 | name.len = sprintf(buf, "journal%u", sdp->sd_journals); |
361 | name.hash = gfs2_disk_hash(name.name, name.len); | 361 | name.hash = gfs2_disk_hash(name.name, name.len); |
362 | 362 | ||
363 | error = gfs2_dir_search(sdp->sd_jindex, &name, NULL, NULL); | 363 | error = gfs2_dir_check(sdp->sd_jindex, &name, NULL); |
364 | if (error == -ENOENT) { | 364 | if (error == -ENOENT) { |
365 | error = 0; | 365 | error = 0; |
366 | break; | 366 | break; |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 601eaa1b9ed6..3f5edc54e80a 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -115,8 +115,8 @@ int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide, | |||
115 | "GFS2: fsid=%s: inode = %llu %llu\n" | 115 | "GFS2: fsid=%s: inode = %llu %llu\n" |
116 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", | 116 | "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", |
117 | sdp->sd_fsname, | 117 | sdp->sd_fsname, |
118 | sdp->sd_fsname, (unsigned long long)ip->i_num.no_formal_ino, | 118 | sdp->sd_fsname, (unsigned long long)ip->i_no_formal_ino, |
119 | (unsigned long long)ip->i_num.no_addr, | 119 | (unsigned long long)ip->i_no_addr, |
120 | sdp->sd_fsname, function, file, line); | 120 | sdp->sd_fsname, function, file, line); |
121 | return rv; | 121 | return rv; |
122 | } | 122 | } |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index 8b7e4c1e32ae..a82ec8c62eff 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -59,13 +59,6 @@ struct gfs2_inum_host { | |||
59 | __u64 no_addr; | 59 | __u64 no_addr; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static inline int gfs2_inum_equal(const struct gfs2_inum_host *ino1, | ||
63 | const struct gfs2_inum_host *ino2) | ||
64 | { | ||
65 | return ino1->no_formal_ino == ino2->no_formal_ino && | ||
66 | ino1->no_addr == ino2->no_addr; | ||
67 | } | ||
68 | |||
69 | /* | 62 | /* |
70 | * Generic metadata head structure | 63 | * Generic metadata head structure |
71 | * Every inplace buffer logged in the journal must start with this. | 64 | * Every inplace buffer logged in the journal must start with this. |
@@ -509,9 +502,9 @@ struct gfs2_quota_change_host { | |||
509 | 502 | ||
510 | #ifdef __KERNEL__ | 503 | #ifdef __KERNEL__ |
511 | /* Translation functions */ | 504 | /* Translation functions */ |
505 | struct gfs2_inode; | ||
512 | 506 | ||
513 | extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf); | 507 | extern void gfs2_inum_out(const struct gfs2_inode *ip, struct gfs2_dirent *dent); |
514 | extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf); | ||
515 | extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf); | 508 | extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf); |
516 | extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf); | 509 | extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf); |
517 | extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf); | 510 | extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf); |