Skip to contentSkip to conversation

tcmu: fix error resetting qfull_time_out to default

PATCH Superseded Prasanna Kumar Kalever 3 participants 4 messages Apr 9, 2018 – Apr 12, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcmu: fix error resetting qfull_time_out to default

Problem:
-------

$ cat /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-1
$ echo "-1" > /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-bash: echo: write error: Invalid argument

Fix:
---
This patch will help reset qfull_time_out to its default i.e. qfull_time_out=-1

---
 drivers/target/target_core_user.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/target/target_core_user.c +2 -0
index 4ad89ea71a70..4f26bdc3d1dc 100644
@@ -2121,6 +2121,8 @@ static ssize_t tcmu_qfull_time_out_store(struct config_item *item,
 
 	if (val >= 0) {
 		udev->qfull_time_out = val * MSEC_PER_SEC;
+	} else if (val = -1) {
+		udev->qfull_time_out = val;
 	} else {
 		printk(KERN_ERR "Invalid qfull timeout value %d\n", val);
 		return -EINVAL;
Signature · 1 line
2.14.3
#1 lore raw
Quoted 22 lines · Prasanna Kumar Kalever

Problem:
-------

$ cat /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-1
$ echo "-1" > /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-bash: echo: write error: Invalid argument

Fix:
---
This patch will help reset qfull_time_out to its default i.e. qfull_time_out=-1

---
  drivers/target/target_core_user.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/target/target_core_user.c +0 -0
index 4ad89ea71a70..4f26bdc3d1dc 100644

drivers/target/target_core_user.c static ssize_t tcmu_qfull_time_out_store(struct config_item *item, · line 2128

Quoted 8 lines
drivers/target/target_core_user.c +2 -0
@@ -2121,6 +2121,8 @@ static ssize_t tcmu_qfull_time_out_store(struct config_item *item,
 
  	if (val >= 0) {
  		udev->qfull_time_out = val * MSEC_PER_SEC;
+	} else if (val = -1) {
+		udev->qfull_time_out = val;
  	} else {
  		printk(KERN_ERR "Invalid qfull timeout value %d\n", val);
  		return -EINVAL;

This looks fine to me.

@Mike, IMO the -1 could also be settable just like this case. And does it have any other special meaning expects to compatible to cmd_time_out ?

Thanks,

#2 lore raw
In reply to Prasanna Kumar Kalever
Quoted 38 lines · Xiubo Li
Quoted 25 lines · Prasanna Kumar Kalever

Problem:
-------

$ cat /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-1
$ echo "-1" >
/sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-bash: echo: write error: Invalid argument

Fix:
---
This patch will help reset qfull_time_out to its default i.e. qfull_time_out=-1

---
  drivers/target/target_core_user.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/target/target_core_user.c +0 -0
index 4ad89ea71a70..4f26bdc3d1dc 100644

drivers/target/target_core_user.c static ssize_t tcmu_qfull_time_out_store(struct · line 2128

Quoted 8 lines
drivers/target/target_core_user.c +2 -0
@@ -2121,6 +2121,8 @@ static ssize_t tcmu_qfull_time_out_store(struct
 config_item *item,
        if (val >= 0) {
          udev->qfull_time_out = val * MSEC_PER_SEC;
+    } else if (val = -1) {
+        udev->qfull_time_out = val;
      } else {
          printk(KERN_ERR "Invalid qfull timeout value %d\n", val);
          return -EINVAL;

This looks fine to me.

Quoted 3 lines

@Mike, IMO the -1 could also be settable just like this case. And does it have any other special meaning expects to compatible to cmd_time_out ?

It was just for backwards compat. It was not meant to be settable, because I didn't think someone would actually want to set it then reset it to the compat mode again.

It seems fine.

Acked-by on v1 1/1
#3 lore raw
In reply to Prasanna Kumar Kalever
Quoted 23 lines · Prasanna Kumar Kalever

Problem:
-------

$ cat /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-1
$ echo "-1" > /sys/kernel/config/target/core/user_0/block/attrib/qfull_time_out
-bash: echo: write error: Invalid argument

Fix:
---
This patch will help reset qfull_time_out to its default i.e. qfull_time_out=-1

---
 drivers/target/target_core_user.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/target/target_core_user.c +0 -0
index 4ad89ea71a70..4f26bdc3d1dc 100644

drivers/target/target_core_user.c static ssize_t tcmu_qfull_time_out_store(struct config_item *item, · line 2128

Quoted 8 lines
drivers/target/target_core_user.c +2 -0
@@ -2121,6 +2121,8 @@ static ssize_t tcmu_qfull_time_out_store(struct config_item *item,
 
 	if (val >= 0) {
 		udev->qfull_time_out = val * MSEC_PER_SEC;
+	} else if (val = -1) {
+		udev->qfull_time_out = val;
 	} else {
 		printk(KERN_ERR "Invalid qfull timeout value %d\n", val);
 		return -EINVAL;