From b71d300c8bc0f3617eef4a9c96aebbadeb259177 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 27 Jun 2006 12:45:17 +1000 Subject: [XFS] link(2) on directory is banned in VFS. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26293a Signed-off-by: Alexey Dobriyan Signed-off-by: Nathan Scott --- fs/xfs/xfs_vnodeops.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 00a6b7dc24a0..23cfa5837728 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -2603,8 +2603,7 @@ xfs_link( vn_trace_entry(src_vp, __FUNCTION__, (inst_t *)__return_address); target_namelen = VNAMELEN(dentry); - if (VN_ISDIR(src_vp)) - return XFS_ERROR(EPERM); + ASSERT(!VN_ISDIR(src_vp)); sip = xfs_vtoi(src_vp); tdp = XFS_BHVTOI(target_dir_bdp); @@ -2699,9 +2698,8 @@ xfs_link( xfs_trans_log_inode(tp, tdp, XFS_ILOG_CORE); error = xfs_bumplink(tp, sip); - if (error) { + if (error) goto abort_return; - } /* * If this is a synchronous mount, make sure that the @@ -2719,9 +2717,8 @@ xfs_link( } error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); - if (error) { + if (error) goto std_return; - } /* Fall through to std_return with error = 0. */ std_return: @@ -2742,6 +2739,8 @@ std_return: xfs_trans_cancel(tp, cancel_flags); goto std_return; } + + /* * xfs_mkdir * -- cgit v1.2.3 From 71306f3b880539fb4c579fbd16da552ebb10f29b Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 27 Jun 2006 14:10:29 +1000 Subject: [XFS] * There is trivial "inode => vnode => inode" conversion, but only flags and mode of final inode are looked at. Pass original inode instead. * Two occurences of bhv_vnode_t go out. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26298a Signed-off-by: Alexey Dobriyan Signed-off-by: Nathan Scott --- fs/xfs/linux-2.6/xfs_vnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index 35c6a01963a7..c42b3221b20c 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h @@ -93,7 +93,7 @@ typedef enum { */ static inline struct bhv_vnode *vn_from_inode(struct inode *inode) { - return (bhv_vnode_t *)list_entry(inode, bhv_vnode_t, v_inode); + return container_of(inode, bhv_vnode_t, v_inode); } static inline struct inode *vn_to_inode(struct bhv_vnode *vnode) { -- cgit v1.2.3 From b3bbed1d08e925a12ebbe6326d17554902b3d9ab Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 27 Jun 2006 16:12:15 +1000 Subject: [XFS] remove unused behaviour lock - shrink XFS vnode as a side effect. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26299a Signed-off-by: Alexey Dobriyan Signed-off-by: Nathan Scott --- fs/xfs/xfs_behavior.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/xfs/xfs_behavior.h b/fs/xfs/xfs_behavior.h index 1d8ff103201c..6e6e56fb352d 100644 --- a/fs/xfs/xfs_behavior.h +++ b/fs/xfs/xfs_behavior.h @@ -78,15 +78,12 @@ * */ -struct bhv_head_lock; - /* * Behavior head. Head of the chain of behaviors. * Contained within each virtualized object data structure. */ typedef struct bhv_head { struct bhv_desc *bh_first; /* first behavior in chain */ - struct bhv_head_lock *bh_lockp; /* pointer to lock info struct */ } bhv_head_t; /* -- cgit v1.2.3 From 1998764e5a1700ffad2cab29b7b2a175364e5b70 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 27 Jun 2006 16:12:40 +1000 Subject: [XFS] Reduce size of xfs_trans_t structure. * remove ->t_forw, ->t_back -- unused * ->t_ag_freeblks_delta, ->t_ag_flist_delta, ->t_ag_btree_delta are debugging aid -- wrap them in everyone's favourite way. As a result, cut "xfs_trans" slab object size from 592 to 572 bytes here. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26319a Signed-off-by: Alexey Dobriyan Signed-off-by: Nathan Scott --- fs/xfs/xfs_trans.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index cb65c3a603f5..9dc88b380608 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h @@ -338,8 +338,6 @@ typedef void (*xfs_trans_callback_t)(struct xfs_trans *, void *); typedef struct xfs_trans { unsigned int t_magic; /* magic number */ xfs_log_callback_t t_logcb; /* log callback struct */ - struct xfs_trans *t_forw; /* async list pointers */ - struct xfs_trans *t_back; /* async list pointers */ unsigned int t_type; /* transaction type */ unsigned int t_log_res; /* amt of log space resvd */ unsigned int t_log_count; /* count for perm log res */ @@ -364,9 +362,11 @@ typedef struct xfs_trans { long t_res_fdblocks_delta; /* on-disk only chg */ long t_frextents_delta;/* superblock freextents chg*/ long t_res_frextents_delta; /* on-disk only chg */ +#ifdef DEBUG long t_ag_freeblks_delta; /* debugging counter */ long t_ag_flist_delta; /* debugging counter */ long t_ag_btree_delta; /* debugging counter */ +#endif long t_dblocks_delta;/* superblock dblocks change */ long t_agcount_delta;/* superblock agcount change */ long t_imaxpct_delta;/* superblock imaxpct change */ -- cgit v1.2.3 From ebe1090549a7821faac09c467fc80b2245d0d30e Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 27 Jun 2006 16:13:02 +1000 Subject: [XFS] Remove a couple of no-longer-used macros. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26339a Signed-off-by: Nathan Scott --- fs/xfs/linux-2.6/xfs_linux.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index aa26ab906c88..028eb17ec2ed 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h @@ -140,9 +140,7 @@ BUFFER_FNS(PrivateStart, unwritten); #define current_pid() (current->pid) #define current_fsuid(cred) (current->fsuid) #define current_fsgid(cred) (current->fsgid) -#define current_set_flags(f) (current->flags |= (f)) #define current_test_flags(f) (current->flags & (f)) -#define current_clear_flags(f) (current->flags & ~(f)) #define current_set_flags_nested(sp, f) \ (*(sp) = current->flags, current->flags |= (f)) #define current_clear_flags_nested(sp, f) \ -- cgit v1.2.3 From 05a3332885dd143496694bcecff223339880d7c9 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Tue, 27 Jun 2006 16:13:29 +1000 Subject: [XFS] Remove redundant directory checks from inode link operation. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26343a Signed-off-by: Alexey Dobriyan Signed-off-by: Nathan Scott --- fs/xfs/linux-2.6/xfs_iops.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 12810baeb5d4..b3b46457f151 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c @@ -419,9 +419,6 @@ xfs_vn_link( int error; ip = old_dentry->d_inode; /* inode being linked to */ - if (S_ISDIR(ip->i_mode)) - return -EPERM; - tdvp = vn_from_inode(dir); vp = vn_from_inode(ip); -- cgit v1.2.3 From 97dfd70c8958a634157e0b35711cca01ff6f959b Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 27 Jun 2006 16:13:46 +1000 Subject: [XFS] Remove a race condition where a linked inode could BUG_ON in d_instantiate, due to fast transaction committal removing the last remaining reference before we were all done. SGI-PV: 953287 SGI-Modid: xfs-linux-melb:xfs-kern:26347a Signed-off-by: Nathan Scott --- fs/xfs/linux-2.6/xfs_iops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index b3b46457f151..d9180020de63 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c @@ -422,10 +422,12 @@ xfs_vn_link( tdvp = vn_from_inode(dir); vp = vn_from_inode(ip); + VN_HOLD(vp); error = bhv_vop_link(tdvp, vp, dentry, NULL); - if (likely(!error)) { + if (unlikely(error)) { + VN_RELE(vp); + } else { VMODIFY(tdvp); - VN_HOLD(vp); xfs_validate_fields(ip, &vattr); d_instantiate(dentry, ip); } -- cgit v1.2.3 From 73024cf11522c0233228453984b2a2b37885e336 Mon Sep 17 00:00:00 2001 From: Eric Sesterhenn Date: Wed, 28 Jun 2006 08:42:26 +1000 Subject: [XFS] Fix realtime subvolume expansion, a porting bug b0rked it. Coverity made me look at this code (bug id #344). We only return with XFS_ERROR(EINVAL) if mp->m_rtdev_targp is valid and pass it otherwise to xfs_read_buf() where some function calls later it gets dereferenced by an assert. SGI-PV: 954266 SGI-Modid: xfs-linux-melb:xfs-kern:26363a Signed-off-by: Eric Sesterhenn Signed-off-by: Nathan Scott --- fs/xfs/xfs_rtalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 0c1e42b037ef..5a0b678956e0 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -1929,7 +1929,7 @@ xfs_growfs_rt( /* * Initial error checking. */ - if (mp->m_rtdev_targp || mp->m_rbmip == NULL || + if (mp->m_rtdev_targp == NULL || mp->m_rbmip == NULL || (nrblocks = in->newblocks) <= sbp->sb_rblocks || (sbp->sb_rblocks && (in->extsize != sbp->sb_rextsize))) return XFS_ERROR(EINVAL); -- cgit v1.2.3 From 6fdf8ccc09fd764a9cce11006aa3fca53ac1c895 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 28 Jun 2006 10:13:52 +1000 Subject: [XFS] Rework code snippets slightly to remove remaining recent-gcc warnings. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26364a Signed-off-by: Nathan Scott --- fs/xfs/xfs_inode.c | 4 ++-- fs/xfs/xfs_log_recover.c | 2 ++ fs/xfs/xfs_mount.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 5fa0adb7e173..86c1bf0bba9e 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1961,9 +1961,9 @@ xfs_iunlink_remove( xfs_agino_t agino; xfs_agino_t next_agino; xfs_buf_t *last_ibp; - xfs_dinode_t *last_dip; + xfs_dinode_t *last_dip = NULL; short bucket_index; - int offset, last_offset; + int offset, last_offset = 0; int error; int agi_ok; diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 55b4237c2153..3cb678e3a132 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -990,6 +990,8 @@ xlog_find_zeroed( xfs_daddr_t num_scan_bblks; int error, log_bbnum = log->l_logBBsize; + *blk_no = 0; + /* check totally zeroed log */ bp = xlog_get_bp(log, 1); if (!bp) diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 10dbf203c62f..22d3a1c75474 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -2026,7 +2026,7 @@ xfs_icsb_balance_counter( xfs_sb_field_t field, int flags) { - uint64_t count, resid = 0; + uint64_t count, resid; int weight = num_online_cpus(); int s; @@ -2058,6 +2058,7 @@ xfs_icsb_balance_counter( break; default: BUG(); + count = resid = 0; /* quiet, gcc */ break; } -- cgit v1.2.3 From 5493a0fcba8a94baa5c1d80aca21d6ae4b3b573e Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 28 Jun 2006 11:17:28 +1000 Subject: [XFS] Fixup whitespace damage in log_write, remove final warning. SGI-PV: 904196 SGI-Modid: xfs-linux-melb:xfs-kern:26366a Signed-off-by: Nathan Scott --- fs/xfs/xfs_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index d8f5d4cbe8b7..e730328636c3 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1740,10 +1740,10 @@ xlog_write(xfs_mount_t * mp, xlog_in_core_t **commit_iclog, uint flags) { - xlog_t *log = mp->m_log; + xlog_t *log = mp->m_log; xlog_ticket_t *ticket = (xlog_ticket_t *)tic; + xlog_in_core_t *iclog = NULL; /* ptr to current in-core log */ xlog_op_header_t *logop_head; /* ptr to log operation header */ - xlog_in_core_t *iclog; /* ptr to current in-core log */ __psint_t ptr; /* copy address into data region */ int len; /* # xlog_write() bytes 2 still copy */ int index; /* region index currently copying */ -- cgit v1.2.3