diff options
| -rw-r--r-- | fs/ocfs2/namei.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index d9cd4e373a53..b1eb50ae4097 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
| @@ -84,7 +84,7 @@ static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | |||
| 84 | static int ocfs2_orphan_add(struct ocfs2_super *osb, | 84 | static int ocfs2_orphan_add(struct ocfs2_super *osb, |
| 85 | handle_t *handle, | 85 | handle_t *handle, |
| 86 | struct inode *inode, | 86 | struct inode *inode, |
| 87 | struct ocfs2_dinode *fe, | 87 | struct buffer_head *fe_bh, |
| 88 | char *name, | 88 | char *name, |
| 89 | struct ocfs2_dir_lookup_result *lookup, | 89 | struct ocfs2_dir_lookup_result *lookup, |
| 90 | struct inode *orphan_dir_inode); | 90 | struct inode *orphan_dir_inode); |
| @@ -879,7 +879,7 @@ static int ocfs2_unlink(struct inode *dir, | |||
| 879 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | 879 | fe = (struct ocfs2_dinode *) fe_bh->b_data; |
| 880 | 880 | ||
| 881 | if (inode_is_unlinkable(inode)) { | 881 | if (inode_is_unlinkable(inode)) { |
| 882 | status = ocfs2_orphan_add(osb, handle, inode, fe, orphan_name, | 882 | status = ocfs2_orphan_add(osb, handle, inode, fe_bh, orphan_name, |
| 883 | &orphan_insert, orphan_dir); | 883 | &orphan_insert, orphan_dir); |
| 884 | if (status < 0) { | 884 | if (status < 0) { |
| 885 | mlog_errno(status); | 885 | mlog_errno(status); |
| @@ -1300,7 +1300,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
| 1300 | if (S_ISDIR(new_inode->i_mode) || | 1300 | if (S_ISDIR(new_inode->i_mode) || |
| 1301 | (ocfs2_read_links_count(newfe) == 1)) { | 1301 | (ocfs2_read_links_count(newfe) == 1)) { |
| 1302 | status = ocfs2_orphan_add(osb, handle, new_inode, | 1302 | status = ocfs2_orphan_add(osb, handle, new_inode, |
| 1303 | newfe, orphan_name, | 1303 | newfe_bh, orphan_name, |
| 1304 | &orphan_insert, orphan_dir); | 1304 | &orphan_insert, orphan_dir); |
| 1305 | if (status < 0) { | 1305 | if (status < 0) { |
| 1306 | mlog_errno(status); | 1306 | mlog_errno(status); |
| @@ -1911,7 +1911,7 @@ leave: | |||
| 1911 | static int ocfs2_orphan_add(struct ocfs2_super *osb, | 1911 | static int ocfs2_orphan_add(struct ocfs2_super *osb, |
| 1912 | handle_t *handle, | 1912 | handle_t *handle, |
| 1913 | struct inode *inode, | 1913 | struct inode *inode, |
| 1914 | struct ocfs2_dinode *fe, | 1914 | struct buffer_head *fe_bh, |
| 1915 | char *name, | 1915 | char *name, |
| 1916 | struct ocfs2_dir_lookup_result *lookup, | 1916 | struct ocfs2_dir_lookup_result *lookup, |
| 1917 | struct inode *orphan_dir_inode) | 1917 | struct inode *orphan_dir_inode) |
| @@ -1919,6 +1919,7 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
| 1919 | struct buffer_head *orphan_dir_bh = NULL; | 1919 | struct buffer_head *orphan_dir_bh = NULL; |
| 1920 | int status = 0; | 1920 | int status = 0; |
| 1921 | struct ocfs2_dinode *orphan_fe; | 1921 | struct ocfs2_dinode *orphan_fe; |
| 1922 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; | ||
| 1922 | 1923 | ||
| 1923 | mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); | 1924 | mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); |
| 1924 | 1925 | ||
| @@ -1959,6 +1960,21 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
| 1959 | goto leave; | 1960 | goto leave; |
| 1960 | } | 1961 | } |
| 1961 | 1962 | ||
| 1963 | /* | ||
| 1964 | * We're going to journal the change of i_flags and i_orphaned_slot. | ||
| 1965 | * It's safe anyway, though some callers may duplicate the journaling. | ||
| 1966 | * Journaling within the func just make the logic look more | ||
| 1967 | * straightforward. | ||
| 1968 | */ | ||
| 1969 | status = ocfs2_journal_access_di(handle, | ||
| 1970 | INODE_CACHE(inode), | ||
| 1971 | fe_bh, | ||
| 1972 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
| 1973 | if (status < 0) { | ||
| 1974 | mlog_errno(status); | ||
| 1975 | goto leave; | ||
| 1976 | } | ||
| 1977 | |||
| 1962 | le32_add_cpu(&fe->i_flags, OCFS2_ORPHANED_FL); | 1978 | le32_add_cpu(&fe->i_flags, OCFS2_ORPHANED_FL); |
| 1963 | 1979 | ||
| 1964 | /* Record which orphan dir our inode now resides | 1980 | /* Record which orphan dir our inode now resides |
| @@ -1966,6 +1982,8 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
| 1966 | * dir to lock. */ | 1982 | * dir to lock. */ |
| 1967 | fe->i_orphaned_slot = cpu_to_le16(osb->slot_num); | 1983 | fe->i_orphaned_slot = cpu_to_le16(osb->slot_num); |
| 1968 | 1984 | ||
| 1985 | ocfs2_journal_dirty(handle, fe_bh); | ||
| 1986 | |||
| 1969 | mlog(0, "Inode %llu orphaned in slot %d\n", | 1987 | mlog(0, "Inode %llu orphaned in slot %d\n", |
| 1970 | (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num); | 1988 | (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num); |
| 1971 | 1989 | ||
| @@ -2123,7 +2141,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
| 2123 | } | 2141 | } |
| 2124 | 2142 | ||
| 2125 | di = (struct ocfs2_dinode *)new_di_bh->b_data; | 2143 | di = (struct ocfs2_dinode *)new_di_bh->b_data; |
| 2126 | status = ocfs2_orphan_add(osb, handle, inode, di, orphan_name, | 2144 | status = ocfs2_orphan_add(osb, handle, inode, new_di_bh, orphan_name, |
| 2127 | &orphan_insert, orphan_dir); | 2145 | &orphan_insert, orphan_dir); |
| 2128 | if (status < 0) { | 2146 | if (status < 0) { |
| 2129 | mlog_errno(status); | 2147 | mlog_errno(status); |
