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:
o2dlm: force free mles during dlm exit
ocfs2: Sync inode flags with ext2.
ocfs2: Move 'wanted' into parens of ocfs2_resmap_resv_bits.
ocfs2: Use cpu_to_le16 for e_leaf_clusters in ocfs2_bg_discontig_add_extent.
ocfs2: update ctime when changing the file's permission by setfacl
ocfs2/net: fix uninitialized ret in o2net_send_message_vec()
Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
Ocfs2: Re-access the journal after ocfs2_insert_extent() in dxdir codes.
ocfs2: Fix lockdep warning in reflink.
ocfs2/lockdep: Move ip_xattr_sem out of ocfs2_xattr_get_nolock.

+116 -43
+3
fs/ocfs2/acl.c
··· 209 } 210 211 inode->i_mode = new_mode; 212 di->i_mode = cpu_to_le16(inode->i_mode); 213 214 ocfs2_journal_dirty(handle, di_bh); 215
··· 209 } 210 211 inode->i_mode = new_mode; 212 + inode->i_ctime = CURRENT_TIME; 213 di->i_mode = cpu_to_le16(inode->i_mode); 214 + di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 215 + di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 216 217 ocfs2_journal_dirty(handle, di_bh); 218
+1 -1
fs/ocfs2/cluster/tcp.c
··· 977 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, 978 size_t caller_veclen, u8 target_node, int *status) 979 { 980 - int ret; 981 struct o2net_msg *msg = NULL; 982 size_t veclen, caller_bytes = 0; 983 struct kvec *vec = NULL;
··· 977 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, 978 size_t caller_veclen, u8 target_node, int *status) 979 { 980 + int ret = 0; 981 struct o2net_msg *msg = NULL; 982 size_t veclen, caller_bytes = 0; 983 struct kvec *vec = NULL;
+16 -8
fs/ocfs2/dir.c
··· 3931 goto out_commit; 3932 } 3933 3934 for (i = 0; i < num_dx_leaves; i++) { 3935 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), 3936 orig_dx_leaves[i], ··· 3948 mlog_errno(ret); 3949 goto out_commit; 3950 } 3951 - } 3952 3953 - cpos = split_hash; 3954 - ret = ocfs2_dx_dir_new_cluster(dir, &et, cpos, handle, 3955 - data_ac, meta_ac, new_dx_leaves, 3956 - num_dx_leaves); 3957 - if (ret) { 3958 - mlog_errno(ret); 3959 - goto out_commit; 3960 } 3961 3962 ocfs2_dx_dir_transfer_leaf(dir, split_hash, handle, tmp_dx_leaf,
··· 3931 goto out_commit; 3932 } 3933 3934 + cpos = split_hash; 3935 + ret = ocfs2_dx_dir_new_cluster(dir, &et, cpos, handle, 3936 + data_ac, meta_ac, new_dx_leaves, 3937 + num_dx_leaves); 3938 + if (ret) { 3939 + mlog_errno(ret); 3940 + goto out_commit; 3941 + } 3942 + 3943 for (i = 0; i < num_dx_leaves; i++) { 3944 ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), 3945 orig_dx_leaves[i], ··· 3939 mlog_errno(ret); 3940 goto out_commit; 3941 } 3942 3943 + ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), 3944 + new_dx_leaves[i], 3945 + OCFS2_JOURNAL_ACCESS_WRITE); 3946 + if (ret) { 3947 + mlog_errno(ret); 3948 + goto out_commit; 3949 + } 3950 } 3951 3952 ocfs2_dx_dir_transfer_leaf(dir, split_hash, handle, tmp_dx_leaf,
+1
fs/ocfs2/dlm/dlmcommon.h
··· 1030 struct dlm_lock_resource *res); 1031 void dlm_clean_master_list(struct dlm_ctxt *dlm, 1032 u8 dead_node); 1033 int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); 1034 int __dlm_lockres_has_locks(struct dlm_lock_resource *res); 1035 int __dlm_lockres_unused(struct dlm_lock_resource *res);
··· 1030 struct dlm_lock_resource *res); 1031 void dlm_clean_master_list(struct dlm_ctxt *dlm, 1032 u8 dead_node); 1033 + void dlm_force_free_mles(struct dlm_ctxt *dlm); 1034 int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); 1035 int __dlm_lockres_has_locks(struct dlm_lock_resource *res); 1036 int __dlm_lockres_unused(struct dlm_lock_resource *res);
+8 -1
fs/ocfs2/dlm/dlmdebug.c
··· 636 spin_lock(&dlm->track_lock); 637 if (oldres) 638 track_list = &oldres->tracking; 639 - else 640 track_list = &dlm->tracking_list; 641 642 list_for_each_entry(res, track_list, tracking) { 643 if (&res->tracking == &dlm->tracking_list) ··· 666 } else 667 dl = NULL; 668 669 /* passed to seq_show */ 670 return dl; 671 }
··· 636 spin_lock(&dlm->track_lock); 637 if (oldres) 638 track_list = &oldres->tracking; 639 + else { 640 track_list = &dlm->tracking_list; 641 + if (list_empty(track_list)) { 642 + dl = NULL; 643 + spin_unlock(&dlm->track_lock); 644 + goto bail; 645 + } 646 + } 647 648 list_for_each_entry(res, track_list, tracking) { 649 if (&res->tracking == &dlm->tracking_list) ··· 660 } else 661 dl = NULL; 662 663 + bail: 664 /* passed to seq_show */ 665 return dl; 666 }
+1
fs/ocfs2/dlm/dlmdomain.c
··· 693 694 dlm_mark_domain_leaving(dlm); 695 dlm_leave_domain(dlm); 696 dlm_complete_dlm_shutdown(dlm); 697 } 698 dlm_put(dlm);
··· 693 694 dlm_mark_domain_leaving(dlm); 695 dlm_leave_domain(dlm); 696 + dlm_force_free_mles(dlm); 697 dlm_complete_dlm_shutdown(dlm); 698 } 699 dlm_put(dlm);
+40
fs/ocfs2/dlm/dlmmaster.c
··· 3433 wake_up(&res->wq); 3434 wake_up(&dlm->migration_wq); 3435 }
··· 3433 wake_up(&res->wq); 3434 wake_up(&dlm->migration_wq); 3435 } 3436 + 3437 + void dlm_force_free_mles(struct dlm_ctxt *dlm) 3438 + { 3439 + int i; 3440 + struct hlist_head *bucket; 3441 + struct dlm_master_list_entry *mle; 3442 + struct hlist_node *tmp, *list; 3443 + 3444 + /* 3445 + * We notified all other nodes that we are exiting the domain and 3446 + * marked the dlm state to DLM_CTXT_LEAVING. If any mles are still 3447 + * around we force free them and wake any processes that are waiting 3448 + * on the mles 3449 + */ 3450 + spin_lock(&dlm->spinlock); 3451 + spin_lock(&dlm->master_lock); 3452 + 3453 + BUG_ON(dlm->dlm_state != DLM_CTXT_LEAVING); 3454 + BUG_ON((find_next_bit(dlm->domain_map, O2NM_MAX_NODES, 0) < O2NM_MAX_NODES)); 3455 + 3456 + for (i = 0; i < DLM_HASH_BUCKETS; i++) { 3457 + bucket = dlm_master_hash(dlm, i); 3458 + hlist_for_each_safe(list, tmp, bucket) { 3459 + mle = hlist_entry(list, struct dlm_master_list_entry, 3460 + master_hash_node); 3461 + if (mle->type != DLM_MLE_BLOCK) { 3462 + mlog(ML_ERROR, "bad mle: %p\n", mle); 3463 + dlm_print_one_mle(mle); 3464 + } 3465 + atomic_set(&mle->woken, 1); 3466 + wake_up(&mle->wq); 3467 + 3468 + __dlm_unlink_mle(dlm, mle); 3469 + __dlm_mle_detach_hb_events(dlm, mle); 3470 + __dlm_put_mle(mle); 3471 + } 3472 + } 3473 + spin_unlock(&dlm->master_lock); 3474 + spin_unlock(&dlm->spinlock); 3475 + }
+1
fs/ocfs2/dlmglue.h
··· 84 OI_LS_PARENT, 85 OI_LS_RENAME1, 86 OI_LS_RENAME2, 87 }; 88 89 int ocfs2_dlm_init(struct ocfs2_super *osb);
··· 84 OI_LS_PARENT, 85 OI_LS_RENAME1, 86 OI_LS_RENAME2, 87 + OI_LS_REFLINK_TARGET, 88 }; 89 90 int ocfs2_dlm_init(struct ocfs2_super *osb);
+24 -11
fs/ocfs2/ocfs2_fs.h
··· 235 #define OCFS2_HAS_REFCOUNT_FL (0x0010) 236 237 /* Inode attributes, keep in sync with EXT2 */ 238 - #define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */ 239 - #define OCFS2_UNRM_FL (0x00000002) /* Undelete */ 240 - #define OCFS2_COMPR_FL (0x00000004) /* Compress file */ 241 - #define OCFS2_SYNC_FL (0x00000008) /* Synchronous updates */ 242 - #define OCFS2_IMMUTABLE_FL (0x00000010) /* Immutable file */ 243 - #define OCFS2_APPEND_FL (0x00000020) /* writes to file may only append */ 244 - #define OCFS2_NODUMP_FL (0x00000040) /* do not dump file */ 245 - #define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */ 246 - #define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */ 247 248 - #define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */ 249 - #define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */ 250 251 /* 252 * Extent record flags (e_node.leaf.flags)
··· 235 #define OCFS2_HAS_REFCOUNT_FL (0x0010) 236 237 /* Inode attributes, keep in sync with EXT2 */ 238 + #define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */ 239 + #define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */ 240 + #define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */ 241 + #define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ 242 + #define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ 243 + #define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ 244 + #define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ 245 + #define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ 246 + /* Reserved for compression usage... */ 247 + #define OCFS2_DIRTY_FL FS_DIRTY_FL 248 + #define OCFS2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */ 249 + #define OCFS2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */ 250 + #define OCFS2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */ 251 + /* End compression flags --- maybe not all used */ 252 + #define OCFS2_BTREE_FL FS_BTREE_FL /* btree format dir */ 253 + #define OCFS2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */ 254 + #define OCFS2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */ 255 + #define OCFS2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */ 256 + #define OCFS2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ 257 + #define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ 258 + #define OCFS2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ 259 + #define OCFS2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ 260 261 + #define OCFS2_FL_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ 262 + #define OCFS2_FL_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ 263 264 /* 265 * Extent record flags (e_node.leaf.flags)
+4 -4
fs/ocfs2/ocfs2_ioctl.h
··· 23 /* 24 * ioctl commands 25 */ 26 - #define OCFS2_IOC_GETFLAGS _IOR('f', 1, long) 27 - #define OCFS2_IOC_SETFLAGS _IOW('f', 2, long) 28 - #define OCFS2_IOC32_GETFLAGS _IOR('f', 1, int) 29 - #define OCFS2_IOC32_SETFLAGS _IOW('f', 2, int) 30 31 /* 32 * Space reservation / allocation / free ioctls and argument structure
··· 23 /* 24 * ioctl commands 25 */ 26 + #define OCFS2_IOC_GETFLAGS FS_IOC_GETFLAGS 27 + #define OCFS2_IOC_SETFLAGS FS_IOC_SETFLAGS 28 + #define OCFS2_IOC32_GETFLAGS FS_IOC32_GETFLAGS 29 + #define OCFS2_IOC32_SETFLAGS FS_IOC32_SETFLAGS 30 31 /* 32 * Space reservation / allocation / free ioctls and argument structure
+3 -2
fs/ocfs2/refcounttree.c
··· 4201 goto out; 4202 } 4203 4204 - mutex_lock(&new_inode->i_mutex); 4205 - ret = ocfs2_inode_lock(new_inode, &new_bh, 1); 4206 if (ret) { 4207 mlog_errno(ret); 4208 goto out_unlock;
··· 4201 goto out; 4202 } 4203 4204 + mutex_lock_nested(&new_inode->i_mutex, I_MUTEX_CHILD); 4205 + ret = ocfs2_inode_lock_nested(new_inode, &new_bh, 1, 4206 + OI_LS_REFLINK_TARGET); 4207 if (ret) { 4208 mlog_errno(ret); 4209 goto out_unlock;
+10 -12
fs/ocfs2/reservations.c
··· 732 struct ocfs2_alloc_reservation *resv, 733 int *cstart, int *clen) 734 { 735 - unsigned int wanted = *clen; 736 - 737 if (resv == NULL || ocfs2_resmap_disabled(resmap)) 738 return -ENOSPC; 739 740 spin_lock(&resv_lock); 741 742 - /* 743 - * We don't want to over-allocate for temporary 744 - * windows. Otherwise, we run the risk of fragmenting the 745 - * allocation space. 746 - */ 747 - wanted = ocfs2_resv_window_bits(resmap, resv); 748 - if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) 749 - wanted = *clen; 750 - 751 if (ocfs2_resv_empty(resv)) { 752 - mlog(0, "empty reservation, find new window\n"); 753 754 /* 755 * Try to get a window here. If it works, we must fall 756 * through and test the bitmap . This avoids some
··· 732 struct ocfs2_alloc_reservation *resv, 733 int *cstart, int *clen) 734 { 735 if (resv == NULL || ocfs2_resmap_disabled(resmap)) 736 return -ENOSPC; 737 738 spin_lock(&resv_lock); 739 740 if (ocfs2_resv_empty(resv)) { 741 + /* 742 + * We don't want to over-allocate for temporary 743 + * windows. Otherwise, we run the risk of fragmenting the 744 + * allocation space. 745 + */ 746 + unsigned int wanted = ocfs2_resv_window_bits(resmap, resv); 747 748 + if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) 749 + wanted = *clen; 750 + 751 + mlog(0, "empty reservation, find new window\n"); 752 /* 753 * Try to get a window here. If it works, we must fall 754 * through and test the bitmap . This avoids some
+2 -2
fs/ocfs2/suballoc.c
··· 357 static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb, 358 struct ocfs2_group_desc *bg, 359 struct ocfs2_chain_list *cl, 360 - u64 p_blkno, u32 clusters) 361 { 362 struct ocfs2_extent_list *el = &bg->bg_list; 363 struct ocfs2_extent_rec *rec; ··· 369 rec->e_blkno = cpu_to_le64(p_blkno); 370 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / 371 le16_to_cpu(cl->cl_bpc)); 372 - rec->e_leaf_clusters = cpu_to_le32(clusters); 373 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); 374 le16_add_cpu(&bg->bg_free_bits_count, 375 clusters * le16_to_cpu(cl->cl_bpc));
··· 357 static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb, 358 struct ocfs2_group_desc *bg, 359 struct ocfs2_chain_list *cl, 360 + u64 p_blkno, unsigned int clusters) 361 { 362 struct ocfs2_extent_list *el = &bg->bg_list; 363 struct ocfs2_extent_rec *rec; ··· 369 rec->e_blkno = cpu_to_le64(p_blkno); 370 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / 371 le16_to_cpu(cl->cl_bpc)); 372 + rec->e_leaf_clusters = cpu_to_le16(clusters); 373 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); 374 le16_add_cpu(&bg->bg_free_bits_count, 375 clusters * le16_to_cpu(cl->cl_bpc));
+2 -2
fs/ocfs2/xattr.c
··· 1286 xis.inode_bh = xbs.inode_bh = di_bh; 1287 di = (struct ocfs2_dinode *)di_bh->b_data; 1288 1289 - down_read(&oi->ip_xattr_sem); 1290 ret = ocfs2_xattr_ibody_get(inode, name_index, name, buffer, 1291 buffer_size, &xis); 1292 if (ret == -ENODATA && di->i_xattr_loc) 1293 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer, 1294 buffer_size, &xbs); 1295 - up_read(&oi->ip_xattr_sem); 1296 1297 return ret; 1298 } ··· 1314 mlog_errno(ret); 1315 return ret; 1316 } 1317 ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index, 1318 name, buffer, buffer_size); 1319 1320 ocfs2_inode_unlock(inode, 0); 1321
··· 1286 xis.inode_bh = xbs.inode_bh = di_bh; 1287 di = (struct ocfs2_dinode *)di_bh->b_data; 1288 1289 ret = ocfs2_xattr_ibody_get(inode, name_index, name, buffer, 1290 buffer_size, &xis); 1291 if (ret == -ENODATA && di->i_xattr_loc) 1292 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer, 1293 buffer_size, &xbs); 1294 1295 return ret; 1296 } ··· 1316 mlog_errno(ret); 1317 return ret; 1318 } 1319 + down_read(&OCFS2_I(inode)->ip_xattr_sem); 1320 ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index, 1321 name, buffer, buffer_size); 1322 + up_read(&OCFS2_I(inode)->ip_xattr_sem); 1323 1324 ocfs2_inode_unlock(inode, 0); 1325