diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-29 17:42:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-29 17:42:39 -0400 |
| commit | 9623e5a23724d09283c238960946ec6f65733afe (patch) | |
| tree | 5fc1e3ef74ae13ff28c2357f35579af5fdc3f045 | |
| parent | 9f321603724be7386ea39ea41fd885954db60a4a (diff) | |
| parent | 14741472a05245ed5778aa0aec055e1f920b6ef8 (diff) | |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
ocfs2: Fix a race in o2dlm lockres mastery
Ocfs2: Handle deletion of reflinked oprhan inodes correctly.
Ocfs2: Journaling i_flags and i_orphaned_slot when adding inode to orphan dir.
ocfs2: Clear undo bits when local alloc is freed
ocfs2: Init meta_ac properly in ocfs2_create_empty_xattr_block.
ocfs2: Fix the update of name_offset when removing xattrs
ocfs2: Always try for maximum bits with new local alloc windows
ocfs2: set i_mode on disk during acl operations
ocfs2: Update i_blocks in reflink operations.
ocfs2: Change bg_chain check for ocfs2_validate_gd_parent.
[PATCH] Skip check for mandatory locks when unlocking
| -rw-r--r-- | fs/ocfs2/acl.c | 77 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 4 | ||||
| -rw-r--r-- | fs/ocfs2/inode.c | 15 | ||||
| -rw-r--r-- | fs/ocfs2/localalloc.c | 10 | ||||
| -rw-r--r-- | fs/ocfs2/locks.c | 2 | ||||
| -rw-r--r-- | fs/ocfs2/namei.c | 28 | ||||
| -rw-r--r-- | fs/ocfs2/ocfs2.h | 14 | ||||
| -rw-r--r-- | fs/ocfs2/refcounttree.c | 1 | ||||
| -rw-r--r-- | fs/ocfs2/suballoc.c | 129 | ||||
| -rw-r--r-- | fs/ocfs2/suballoc.h | 5 | ||||
| -rw-r--r-- | fs/ocfs2/xattr.c | 12 |
11 files changed, 223 insertions, 74 deletions
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index 0501974bedd0..8ccf0f8c9cc8 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #include "alloc.h" | 30 | #include "alloc.h" |
| 31 | #include "dlmglue.h" | 31 | #include "dlmglue.h" |
| 32 | #include "file.h" | 32 | #include "file.h" |
| 33 | #include "inode.h" | ||
| 34 | #include "journal.h" | ||
| 33 | #include "ocfs2_fs.h" | 35 | #include "ocfs2_fs.h" |
| 34 | 36 | ||
| 35 | #include "xattr.h" | 37 | #include "xattr.h" |
| @@ -166,6 +168,60 @@ static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type) | |||
| 166 | } | 168 | } |
| 167 | 169 | ||
| 168 | /* | 170 | /* |
| 171 | * Helper function to set i_mode in memory and disk. Some call paths | ||
| 172 | * will not have di_bh or a journal handle to pass, in which case it | ||
| 173 | * will create it's own. | ||
| 174 | */ | ||
| 175 | static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh, | ||
| 176 | handle_t *handle, umode_t new_mode) | ||
| 177 | { | ||
| 178 | int ret, commit_handle = 0; | ||
| 179 | struct ocfs2_dinode *di; | ||
| 180 | |||
| 181 | if (di_bh == NULL) { | ||
| 182 | ret = ocfs2_read_inode_block(inode, &di_bh); | ||
| 183 | if (ret) { | ||
| 184 | mlog_errno(ret); | ||
| 185 | goto out; | ||
| 186 | } | ||
| 187 | } else | ||
| 188 | get_bh(di_bh); | ||
| 189 | |||
| 190 | if (handle == NULL) { | ||
| 191 | handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb), | ||
| 192 | OCFS2_INODE_UPDATE_CREDITS); | ||
| 193 | if (IS_ERR(handle)) { | ||
| 194 | ret = PTR_ERR(handle); | ||
| 195 | mlog_errno(ret); | ||
| 196 | goto out_brelse; | ||
| 197 | } | ||
| 198 | |||
| 199 | commit_handle = 1; | ||
| 200 | } | ||
| 201 | |||
| 202 | di = (struct ocfs2_dinode *)di_bh->b_data; | ||
| 203 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh, | ||
| 204 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
| 205 | if (ret) { | ||
| 206 | mlog_errno(ret); | ||
| 207 | goto out_commit; | ||
| 208 | } | ||
| 209 | |||
| 210 | inode->i_mode = new_mode; | ||
| 211 | di->i_mode = cpu_to_le16(inode->i_mode); | ||
| 212 | |||
| 213 | ocfs2_journal_dirty(handle, di_bh); | ||
| 214 | |||
| 215 | out_commit: | ||
| 216 | if (commit_handle) | ||
| 217 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | ||
| 218 | out_brelse: | ||
| 219 | brelse(di_bh); | ||
| 220 | out: | ||
| 221 | return ret; | ||
| 222 | } | ||
| 223 | |||
| 224 | /* | ||
| 169 | * Set the access or default ACL of an inode. | 225 | * Set the access or default ACL of an inode. |
| 170 | */ | 226 | */ |
| 171 | static int ocfs2_set_acl(handle_t *handle, | 227 | static int ocfs2_set_acl(handle_t *handle, |
| @@ -193,9 +249,14 @@ static int ocfs2_set_acl(handle_t *handle, | |||
| 193 | if (ret < 0) | 249 | if (ret < 0) |
| 194 | return ret; | 250 | return ret; |
| 195 | else { | 251 | else { |
| 196 | inode->i_mode = mode; | ||
| 197 | if (ret == 0) | 252 | if (ret == 0) |
| 198 | acl = NULL; | 253 | acl = NULL; |
| 254 | |||
| 255 | ret = ocfs2_acl_set_mode(inode, di_bh, | ||
| 256 | handle, mode); | ||
| 257 | if (ret) | ||
| 258 | return ret; | ||
| 259 | |||
| 199 | } | 260 | } |
| 200 | } | 261 | } |
| 201 | break; | 262 | break; |
| @@ -283,6 +344,7 @@ int ocfs2_init_acl(handle_t *handle, | |||
| 283 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 344 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 284 | struct posix_acl *acl = NULL; | 345 | struct posix_acl *acl = NULL; |
| 285 | int ret = 0; | 346 | int ret = 0; |
| 347 | mode_t mode; | ||
| 286 | 348 | ||
| 287 | if (!S_ISLNK(inode->i_mode)) { | 349 | if (!S_ISLNK(inode->i_mode)) { |
| 288 | if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) { | 350 | if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) { |
| @@ -291,12 +353,17 @@ int ocfs2_init_acl(handle_t *handle, | |||
| 291 | if (IS_ERR(acl)) | 353 | if (IS_ERR(acl)) |
| 292 | return PTR_ERR(acl); | 354 | return PTR_ERR(acl); |
| 293 | } | 355 | } |
| 294 | if (!acl) | 356 | if (!acl) { |
| 295 | inode->i_mode &= ~current_umask(); | 357 | mode = inode->i_mode & ~current_umask(); |
| 358 | ret = ocfs2_acl_set_mode(inode, di_bh, handle, mode); | ||
| 359 | if (ret) { | ||
| 360 | mlog_errno(ret); | ||
| 361 | goto cleanup; | ||
| 362 | } | ||
| 363 | } | ||
| 296 | } | 364 | } |
| 297 | if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { | 365 | if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) { |
| 298 | struct posix_acl *clone; | 366 | struct posix_acl *clone; |
| 299 | mode_t mode; | ||
| 300 | 367 | ||
| 301 | if (S_ISDIR(inode->i_mode)) { | 368 | if (S_ISDIR(inode->i_mode)) { |
| 302 | ret = ocfs2_set_acl(handle, inode, di_bh, | 369 | ret = ocfs2_set_acl(handle, inode, di_bh, |
| @@ -313,7 +380,7 @@ int ocfs2_init_acl(handle_t *handle, | |||
| 313 | mode = inode->i_mode; | 380 | mode = inode->i_mode; |
| 314 | ret = posix_acl_create_masq(clone, &mode); | 381 | ret = posix_acl_create_masq(clone, &mode); |
| 315 | if (ret >= 0) { | 382 | if (ret >= 0) { |
| 316 | inode->i_mode = mode; | 383 | ret = ocfs2_acl_set_mode(inode, di_bh, handle, mode); |
| 317 | if (ret > 0) { | 384 | if (ret > 0) { |
| 318 | ret = ocfs2_set_acl(handle, inode, | 385 | ret = ocfs2_set_acl(handle, inode, |
| 319 | di_bh, ACL_TYPE_ACCESS, | 386 | di_bh, ACL_TYPE_ACCESS, |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index a659606dcb95..9289b4357d27 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
| @@ -1875,7 +1875,6 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data, | |||
| 1875 | ok: | 1875 | ok: |
| 1876 | spin_unlock(&res->spinlock); | 1876 | spin_unlock(&res->spinlock); |
| 1877 | } | 1877 | } |
| 1878 | spin_unlock(&dlm->spinlock); | ||
| 1879 | 1878 | ||
| 1880 | // mlog(0, "woo! got an assert_master from node %u!\n", | 1879 | // mlog(0, "woo! got an assert_master from node %u!\n", |
| 1881 | // assert->node_idx); | 1880 | // assert->node_idx); |
| @@ -1926,7 +1925,6 @@ ok: | |||
| 1926 | /* master is known, detach if not already detached. | 1925 | /* master is known, detach if not already detached. |
| 1927 | * ensures that only one assert_master call will happen | 1926 | * ensures that only one assert_master call will happen |
| 1928 | * on this mle. */ | 1927 | * on this mle. */ |
| 1929 | spin_lock(&dlm->spinlock); | ||
| 1930 | spin_lock(&dlm->master_lock); | 1928 | spin_lock(&dlm->master_lock); |
| 1931 | 1929 | ||
| 1932 | rr = atomic_read(&mle->mle_refs.refcount); | 1930 | rr = atomic_read(&mle->mle_refs.refcount); |
| @@ -1959,7 +1957,6 @@ ok: | |||
| 1959 | __dlm_put_mle(mle); | 1957 | __dlm_put_mle(mle); |
| 1960 | } | 1958 | } |
| 1961 | spin_unlock(&dlm->master_lock); | 1959 | spin_unlock(&dlm->master_lock); |
| 1962 | spin_unlock(&dlm->spinlock); | ||
| 1963 | } else if (res) { | 1960 | } else if (res) { |
| 1964 | if (res->owner != assert->node_idx) { | 1961 | if (res->owner != assert->node_idx) { |
| 1965 | mlog(0, "assert_master from %u, but current " | 1962 | mlog(0, "assert_master from %u, but current " |
| @@ -1967,6 +1964,7 @@ ok: | |||
| 1967 | res->owner, namelen, name); | 1964 | res->owner, namelen, name); |
| 1968 | } | 1965 | } |
| 1969 | } | 1966 | } |
| 1967 | spin_unlock(&dlm->spinlock); | ||
