Skip to contentSkip to conversation

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods - affects targetcli restore

5.14-rc1 regression Yanko Kaneti 3 participants 5 messages Jul 12, 2021 – Jul 14, 2021

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

Hello,

Bisected a problem that I have with targetcli restore to:

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods

With it reads of /sys/kernel/config/target/dbroot go on infinitely, returning the config value over and over again.

e.g.

$ modprobe target_core_user
$ head -n 2 /sys/kernel/config/target/dbroot 
/etc/target
/etc/target

Don't know if that's a problem with the commit or the target code, but could perhaps be affecting other places.

- Yanko

#1 lore raw
Quoted 9 lines · Yanko Kaneti

Bisected a problem that I have with targetcli restore to:

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods

With it reads of /sys/kernel/config/target/dbroot go on infinitely, returning the config value over and over again.

e.g.

Quoted 7 lines
$ modprobe target_core_user
$ head -n 2 /sys/kernel/config/target/dbroot
/etc/target
/etc/target

Don't know if that's a problem with the commit or the target code, but could perhaps be affecting other places.

The dbroot show method looks fine to me:

static ssize_t target_core_item_dbroot_show(struct config_item *item,
char *page)

{
	return sprintf(page, "%s\n", db_root);
}

Anyway, I can reproduce this behavior. I will take a look at this.

Bart.

#2 lore raw
Quoted 20 lines · Bart Van Assche
Quoted 9 lines · Yanko Kaneti

Bisected a problem that I have with targetcli restore to:

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods

With it reads of /sys/kernel/config/target/dbroot go on infinitely, returning the config value over and over again.

e.g.

Quoted 7 lines
$ modprobe target_core_user
$ head -n 2 /sys/kernel/config/target/dbroot
/etc/target
/etc/target

Don't know if that's a problem with the commit or the target code, but could perhaps be affecting other places.

The dbroot show method looks fine to me:

Quoted 7 lines

static ssize_t target_core_item_dbroot_show(struct config_item *item,
char *page)

{
	return sprintf(page, "%s\n", db_root);
}

Anyway, I can reproduce this behavior. I will take a look at this.

The problem exists for all configs users, we (RDMA) experience the same issue with default_roce_mode and default_roce_tos files.

The configfs_read_iter() doesn't indicate to the upper layer that it should stop reread. In my case, the iov_iter_count(to) is equal to 131072, which is huge comparable to real buffer->count.

....

[  192.077873] configfs: configfs_read_iter: count = 131072, pos = 15880, buf = RoCE v2
[  192.078146] configfs: configfs_read_iter: count = 131072, pos = 15888, buf = RoCE v2
[  192.078510] configfs: configfs_read_iter: count = 131072, pos = 15896, buf = RoCE v2

....

Thanks

Quoted 2 lines

Bart.

#3 lore raw
Quoted 36 lines · Leon Romanovsky
Quoted 20 lines · Bart Van Assche
Quoted 9 lines · Yanko Kaneti

Bisected a problem that I have with targetcli restore to:

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods

With it reads of /sys/kernel/config/target/dbroot go on infinitely, returning the config value over and over again.

e.g.

Quoted 7 lines
$ modprobe target_core_user
$ head -n 2 /sys/kernel/config/target/dbroot
/etc/target
/etc/target

Don't know if that's a problem with the commit or the target code, but could perhaps be affecting other places.

The dbroot show method looks fine to me:

Quoted 7 lines

static ssize_t target_core_item_dbroot_show(struct config_item *item,
char *page)

{
	return sprintf(page, "%s\n", db_root);
}

Anyway, I can reproduce this behavior. I will take a look at this.

The problem exists for all configs users, we (RDMA) experience the same issue with default_roce_mode and default_roce_tos files.

The configfs_read_iter() doesn't indicate to the upper layer that it should stop reread. In my case, the iov_iter_count(to) is equal to 131072, which is huge comparable to real buffer->count.

Quoted 5 lines

....

[  192.077873] configfs: configfs_read_iter: count = 131072, pos = 15880, buf = RoCE v2
[  192.078146] configfs: configfs_read_iter: count = 131072, pos = 15888, buf = RoCE v2
[  192.078510] configfs: configfs_read_iter: count = 131072, pos = 15896, buf = RoCE v2

....

The fix Bart posted yesterday works for me here

https://git.infradead.org/users/hch/configfs.git/commit/420405ecde061fde76d67bd3a67577a563ea758e

Thanks

#4 lore raw
Quoted 43 lines · Yanko Kaneti
Quoted 36 lines · Leon Romanovsky
Quoted 20 lines · Bart Van Assche
Quoted 9 lines · Yanko Kaneti

Bisected a problem that I have with targetcli restore to:

7fe1e79b59ba configfs: implement the .read_iter and .write_iter methods

With it reads of /sys/kernel/config/target/dbroot go on infinitely, returning the config value over and over again.

e.g.

Quoted 7 lines
$ modprobe target_core_user
$ head -n 2 /sys/kernel/config/target/dbroot
/etc/target
/etc/target

Don't know if that's a problem with the commit or the target code, but could perhaps be affecting other places.

The dbroot show method looks fine to me:

Quoted 7 lines

static ssize_t target_core_item_dbroot_show(struct config_item *item,
char *page)

{
	return sprintf(page, "%s\n", db_root);
}

Anyway, I can reproduce this behavior. I will take a look at this.

The problem exists for all configs users, we (RDMA) experience the same issue with default_roce_mode and default_roce_tos files.

The configfs_read_iter() doesn't indicate to the upper layer that it should stop reread. In my case, the iov_iter_count(to) is equal to 131072, which is huge comparable to real buffer->count.

Quoted 5 lines

....

[  192.077873] configfs: configfs_read_iter: count = 131072, pos = 15880, buf = RoCE v2
[  192.078146] configfs: configfs_read_iter: count = 131072, pos = 15888, buf = RoCE v2
[  192.078510] configfs: configfs_read_iter: count = 131072, pos = 15896, buf = RoCE v2

....

Quoted 3 lines

The fix Bart posted yesterday works for me here

https://git.infradead.org/users/hch/configfs.git/commit/420405ecde061fde76d67bd3a67577a563ea758e

Thanks a lot, I came mostly to the same fix.