Merge remote-tracking branch 'ovl/rename2' into for-linus
This commit is contained in:
@@ -5922,7 +5922,6 @@ bail:
|
||||
}
|
||||
|
||||
static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
|
||||
handle_t *handle,
|
||||
struct inode *data_alloc_inode,
|
||||
struct buffer_head *data_alloc_bh)
|
||||
{
|
||||
@@ -5935,11 +5934,19 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
|
||||
struct ocfs2_truncate_log *tl;
|
||||
struct inode *tl_inode = osb->osb_tl_inode;
|
||||
struct buffer_head *tl_bh = osb->osb_tl_bh;
|
||||
handle_t *handle;
|
||||
|
||||
di = (struct ocfs2_dinode *) tl_bh->b_data;
|
||||
tl = &di->id2.i_dealloc;
|
||||
i = le16_to_cpu(tl->tl_used) - 1;
|
||||
while (i >= 0) {
|
||||
handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC);
|
||||
if (IS_ERR(handle)) {
|
||||
status = PTR_ERR(handle);
|
||||
mlog_errno(status);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* Caller has given us at least enough credits to
|
||||
* update the truncate log dinode */
|
||||
status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh,
|
||||
@@ -5974,12 +5981,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
|
||||
}
|
||||
}
|
||||
|
||||
status = ocfs2_extend_trans(handle,
|
||||
OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC);
|
||||
if (status < 0) {
|
||||
mlog_errno(status);
|
||||
goto bail;
|
||||
}
|
||||
ocfs2_commit_trans(osb, handle);
|
||||
i--;
|
||||
}
|
||||
|
||||
@@ -5994,7 +5996,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
|
||||
{
|
||||
int status;
|
||||
unsigned int num_to_flush;
|
||||
handle_t *handle;
|
||||
struct inode *tl_inode = osb->osb_tl_inode;
|
||||
struct inode *data_alloc_inode = NULL;
|
||||
struct buffer_head *tl_bh = osb->osb_tl_bh;
|
||||
@@ -6038,21 +6039,11 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
|
||||
goto out_mutex;
|
||||
}
|
||||
|
||||
handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC);
|
||||
if (IS_ERR(handle)) {
|
||||
status = PTR_ERR(handle);
|
||||
mlog_errno(status);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
status = ocfs2_replay_truncate_records(osb, handle, data_alloc_inode,
|
||||
status = ocfs2_replay_truncate_records(osb, data_alloc_inode,
|
||||
data_alloc_bh);
|
||||
if (status < 0)
|
||||
mlog_errno(status);
|
||||
|
||||
ocfs2_commit_trans(osb, handle);
|
||||
|
||||
out_unlock:
|
||||
brelse(data_alloc_bh);
|
||||
ocfs2_inode_unlock(data_alloc_inode, 1);
|
||||
|
||||
@@ -6413,43 +6404,34 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb,
|
||||
goto out_mutex;
|
||||
}
|
||||
|
||||
handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE);
|
||||
if (IS_ERR(handle)) {
|
||||
ret = PTR_ERR(handle);
|
||||
mlog_errno(ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
while (head) {
|
||||
if (head->free_bg)
|
||||
bg_blkno = head->free_bg;
|
||||
else
|
||||
bg_blkno = ocfs2_which_suballoc_group(head->free_blk,
|
||||
head->free_bit);
|
||||
handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE);
|
||||
if (IS_ERR(handle)) {
|
||||
ret = PTR_ERR(handle);
|
||||
mlog_errno(ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
trace_ocfs2_free_cached_blocks(
|
||||
(unsigned long long)head->free_blk, head->free_bit);
|
||||
|
||||
ret = ocfs2_free_suballoc_bits(handle, inode, di_bh,
|
||||
head->free_bit, bg_blkno, 1);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
mlog_errno(ret);
|
||||
goto out_journal;
|
||||
}
|
||||
|
||||
ret = ocfs2_extend_trans(handle, OCFS2_SUBALLOC_FREE);
|
||||
if (ret) {
|
||||
mlog_errno(ret);
|
||||
goto out_journal;
|
||||
}
|
||||
ocfs2_commit_trans(osb, handle);
|
||||
|
||||
tmp = head;
|
||||
head = head->free_next;
|
||||
kfree(tmp);
|
||||
}
|
||||
|
||||
out_journal:
|
||||
ocfs2_commit_trans(osb, handle);
|
||||
|
||||
out_unlock:
|
||||
ocfs2_inode_unlock(inode, 1);
|
||||
brelse(di_bh);
|
||||
|
@@ -44,9 +44,6 @@
|
||||
* version here in tcp_internal.h should not need to be bumped for
|
||||
* filesystem locking changes.
|
||||
*
|
||||
* New in version 12
|
||||
* - Negotiate hb timeout when storage is down.
|
||||
*
|
||||
* New in version 11
|
||||
* - Negotiation of filesystem locking in the dlm join.
|
||||
*
|
||||
@@ -78,7 +75,7 @@
|
||||
* - full 64 bit i_size in the metadata lock lvbs
|
||||
* - introduction of "rw" lock and pushing meta/data locking down
|
||||
*/
|
||||
#define O2NET_PROTOCOL_VERSION 12ULL
|
||||
#define O2NET_PROTOCOL_VERSION 11ULL
|
||||
struct o2net_handshake {
|
||||
__be64 protocol_version;
|
||||
__be64 connector_id;
|
||||
|
@@ -268,7 +268,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
|
||||
struct dlm_lock *lock, int flags, int type)
|
||||
{
|
||||
enum dlm_status status;
|
||||
u8 old_owner = res->owner;
|
||||
|
||||
mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type,
|
||||
lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
|
||||
@@ -335,7 +334,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
|
||||
|
||||
spin_lock(&res->spinlock);
|
||||
res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
|
||||
lock->convert_pending = 0;
|
||||
/* if it failed, move it back to granted queue.
|
||||
* if master returns DLM_NORMAL and then down before sending ast,
|
||||
* it may have already been moved to granted queue, reset to
|
||||
@@ -344,12 +342,14 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
|
||||
if (status != DLM_NOTQUEUED)
|
||||
dlm_error(status);
|
||||
dlm_revert_pending_convert(res, lock);
|
||||
} else if ((res->state & DLM_LOCK_RES_RECOVERING) ||
|
||||
(old_owner != res->owner)) {
|
||||
mlog(0, "res %.*s is in recovering or has been recovered.\n",
|
||||
res->lockname.len, res->lockname.name);
|
||||
} else if (!lock->convert_pending) {
|
||||
mlog(0, "%s: res %.*s, owner died and lock has been moved back "
|
||||
"to granted list, retry convert.\n",
|
||||
dlm->name, res->lockname.len, res->lockname.name);
|
||||
status = DLM_RECOVERING;
|
||||
}
|
||||
|
||||
lock->convert_pending = 0;
|
||||
bail:
|
||||
spin_unlock(&res->spinlock);
|
||||
|
||||
|
@@ -1506,7 +1506,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
|
||||
u64 start, u64 len)
|
||||
{
|
||||
int ret = 0;
|
||||
u64 tmpend, end = start + len;
|
||||
u64 tmpend = 0;
|
||||
u64 end = start + len;
|
||||
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
|
||||
unsigned int csize = osb->s_clustersize;
|
||||
handle_t *handle;
|
||||
@@ -1538,18 +1539,31 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
|
||||
}
|
||||
|
||||
/*
|
||||
* We want to get the byte offset of the end of the 1st cluster.
|
||||
* If start is on a cluster boundary and end is somewhere in another
|
||||
* cluster, we have not COWed the cluster starting at start, unless
|
||||
* end is also within the same cluster. So, in this case, we skip this
|
||||
* first call to ocfs2_zero_range_for_truncate() truncate and move on
|
||||
* to the next one.
|
||||
*/
|
||||
tmpend = (u64)osb->s_clustersize + (start & ~(osb->s_clustersize - 1));
|
||||
if (tmpend > end)
|
||||
tmpend = end;
|
||||
if ((start & (csize - 1)) != 0) {
|
||||
/*
|
||||
* We want to get the byte offset of the end of the 1st
|
||||
* cluster.
|
||||
*/
|
||||
tmpend = (u64)osb->s_clustersize +
|
||||
(start & ~(osb->s_clustersize - 1));
|
||||
if (tmpend > end)
|
||||
tmpend = end;
|
||||
|
||||
trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start,
|
||||
(unsigned long long)tmpend);
|
||||
trace_ocfs2_zero_partial_clusters_range1(
|
||||
(unsigned long long)start,
|
||||
(unsigned long long)tmpend);
|
||||
|
||||
ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend);
|
||||
if (ret)
|
||||
mlog_errno(ret);
|
||||
ret = ocfs2_zero_range_for_truncate(inode, handle, start,
|
||||
tmpend);
|
||||
if (ret)
|
||||
mlog_errno(ret);
|
||||
}
|
||||
|
||||
if (tmpend < end) {
|
||||
/*
|
||||
|
@@ -1203,7 +1203,8 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2)
|
||||
static int ocfs2_rename(struct inode *old_dir,
|
||||
struct dentry *old_dentry,
|
||||
struct inode *new_dir,
|
||||
struct dentry *new_dentry)
|
||||
struct dentry *new_dentry,
|
||||
unsigned int flags)
|
||||
{
|
||||
int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0;
|
||||
int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0;
|
||||
@@ -1228,6 +1229,9 @@ static int ocfs2_rename(struct inode *old_dir,
|
||||
struct ocfs2_dir_lookup_result target_insert = { NULL, };
|
||||
bool should_add_orphan = false;
|
||||
|
||||
if (flags)
|
||||
return -EINVAL;
|
||||
|
||||
/* At some point it might be nice to break this function up a
|
||||
* bit. */
|
||||
|
||||
|
@@ -1199,14 +1199,24 @@ retry:
|
||||
inode_unlock((*ac)->ac_inode);
|
||||
|
||||
ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted);
|
||||
if (ret == 1)
|
||||
if (ret == 1) {
|
||||
iput((*ac)->ac_inode);
|
||||
(*ac)->ac_inode = NULL;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
mlog_errno(ret);
|
||||
|
||||
inode_lock((*ac)->ac_inode);
|
||||
ocfs2_inode_lock((*ac)->ac_inode, NULL, 1);
|
||||
ret = ocfs2_inode_lock((*ac)->ac_inode, NULL, 1);
|
||||
if (ret < 0) {
|
||||
mlog_errno(ret);
|
||||
inode_unlock((*ac)->ac_inode);
|
||||
iput((*ac)->ac_inode);
|
||||
(*ac)->ac_inode = NULL;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
if (status < 0) {
|
||||
if (status != -ENOSPC)
|
||||
|
Reference in New Issue
Block a user