[PATCH] Revert "nvme-fc: fold t fc_update_appid into fc_appid_store"

Christoph Hellwig hch at lst.de
Mon Aug 1 11:27:14 PDT 2022


On Mon, Aug 01, 2022 at 12:27:13PM -0400, Ewan D. Milne wrote:
> This reverts commit c814153c83a892dfd42026eaa661ae2c1f298792.
> 
> The commit c814153c83a8 "nvme-fc: fold t fc_update_appid into fc_appid_store"
> changed the userspace interface, because the code that decrements "count"
> to remove a trailing '\n' in the parsing results in the decremented value being
> incorrectly be returned from the sysfs write.  Fix this by revering the commit.

Wouldn't something like the patch below be much simpler and cleaner:


diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 9987797620b6d..e24ab688f00d5 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3878,6 +3878,7 @@ static int fc_parse_cgrpid(const char *buf, u64 *id)
 static ssize_t fc_appid_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
+	size_t orig_count = count;
 	u64 cgrp_id;
 	int appid_len = 0;
 	int cgrpid_len = 0;
@@ -3902,7 +3903,7 @@ static ssize_t fc_appid_store(struct device *dev,
 	ret = blkcg_set_fc_appid(app_id, cgrp_id, sizeof(app_id));
 	if (ret < 0)
 		return ret;
-	return count;
+	return orig_count;
 }
 static DEVICE_ATTR(appid_store, 0200, NULL, fc_appid_store);
 #endif /* CONFIG_BLK_CGROUP_FC_APPID */



More information about the Linux-nvme mailing list