Unverified Commit 72458d2c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!406 [sync] PR-399: Backport fs, block and net bugfixes

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/399 
 
Pull fs bugfixes from Zhihao Cheng and ZhaoLong Wang
block bugfix from Yu Kuai
net bugfixes from Liu Jian 
 
Link:https://gitee.com/openeuler/kernel/pulls/406

 

Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 57494e92 3e500c82
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -321,14 +321,12 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq)

static void bfqg_get(struct bfq_group *bfqg)
{
	bfqg->ref++;
	refcount_inc(&bfqg->ref);
}

static void bfqg_put(struct bfq_group *bfqg)
{
	bfqg->ref--;

	if (bfqg->ref == 0)
	if (refcount_dec_and_test(&bfqg->ref))
		kfree(bfqg);
}

@@ -535,7 +533,7 @@ static struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, struct request_queue *q,
	}

	/* see comments in bfq_bic_update_cgroup for why refcounting */
	bfqg_get(bfqg);
	refcount_set(&bfqg->ref, 1);
	return &bfqg->pd;
}

+1 −1
Original line number Diff line number Diff line
@@ -900,7 +900,7 @@ struct bfq_group {
	char blkg_path[128];

	/* reference counter (see comments in bfq_bic_update_cgroup) */
	int ref;
	refcount_t ref;
	/* Is bfq_group still online? */
	bool online;

+7 −5
Original line number Diff line number Diff line
@@ -146,8 +146,10 @@ void ubi_refill_pools(struct ubi_device *ubi)
	if (ubi->fm_anchor) {
		wl_tree_add(ubi->fm_anchor, &ubi->free);
		ubi->free_count++;
		ubi->fm_anchor = NULL;
	}

	if (!ubi->fm_disabled)
		/*
		 * All available PEBs are in ubi->free, now is the time to get
		 * the best anchor PEBs.
+8 −1
Original line number Diff line number Diff line
@@ -885,8 +885,11 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,

	err = do_sync_erase(ubi, e1, vol_id, lnum, 0);
	if (err) {
		if (e2)
		if (e2) {
			spin_lock(&ubi->wl_lock);
			wl_entry_destroy(ubi, e2);
			spin_unlock(&ubi->wl_lock);
		}
		goto out_ro;
	}

@@ -1121,14 +1124,18 @@ static int __erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk)
		/* Re-schedule the LEB for erasure */
		err1 = schedule_erase(ubi, e, vol_id, lnum, 0, false);
		if (err1) {
			spin_lock(&ubi->wl_lock);
			wl_entry_destroy(ubi, e);
			spin_unlock(&ubi->wl_lock);
			err = err1;
			goto out_ro;
		}
		return err;
	}

	spin_lock(&ubi->wl_lock);
	wl_entry_destroy(ubi, e);
	spin_unlock(&ubi->wl_lock);
	if (err != -EIO)
		/*
		 * If this is not %-EIO, we have no idea what to do. Scheduling
+37 −1
Original line number Diff line number Diff line
@@ -1328,6 +1328,42 @@ static int get_option_gid(substring_t args[], kgid_t *result)
	return 0;
}

/*
 * Remove duplicate path delimiters. Windows is supposed to do that
 * but there are some bugs that prevent rename from working if there are
 * multiple delimiters.
 *
 * Returns a sanitized duplicate of @path. The caller is responsible for
 * cleaning up the original.
 */
#define IS_DELIM(c) ((c) == '/' || (c) == '\\')
static char *sanitize_path(char *path)
{
	char *cursor1 = path, *cursor2 = path;

	/* skip all prepended delimiters */
	while (IS_DELIM(*cursor1))
		cursor1++;

	/* copy the first letter */
	*cursor2 = *cursor1;

	/* copy the remainder... */
	while (*(cursor1++)) {
		/* ... skipping all duplicated delimiters */
		if (IS_DELIM(*cursor1) && IS_DELIM(*cursor2))
			continue;
		*(++cursor2) = *cursor1;
	}

	/* if the last character is a delimiter, skip it */
	if (IS_DELIM(*(cursor2 - 1)))
		cursor2--;

	*(cursor2) = '\0';
	return kstrdup(path, GFP_KERNEL);
}

/*
 * Parse a devname into substrings and populate the vol->UNC and vol->prepath
 * fields with the result. Returns 0 on success and an error otherwise.
@@ -1376,7 +1412,7 @@ cifs_parse_devname(const char *devname, struct smb_vol *vol)
	if (!*pos)
		return 0;

	vol->prepath = kstrdup(pos, GFP_KERNEL);
	vol->prepath = sanitize_path(pos);
	if (!vol->prepath)
		return -ENOMEM;

Loading