mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-18 22:14:15 +00:00
The wrapper in setattr_more that translates the operations to attr_x needs to decide whether to ask attr_x to perform a change to any of the fields passed to it or not. For the date and size fields this is implicit - we always tell attr_x to change them. For any of the other fields, it should be explicit. The only field that is in the struct that this applies to is data_version. Because the data version field by default is zero, we use that as condition to decide whether to pass the data_version down to attr_x. Previously, the code would always pass a data_version=0 down to attr_x, triggering one of the validity checks, making it return -EINVAL. We add a simple test case to test for this issue. Signed-off-by: Auke Kok <auke.kok@versity.com>
33 lines
1.5 KiB
Plaintext
33 lines
1.5 KiB
Plaintext
== 0 data_version arg fails
|
|
setattr: data version must not be 0
|
|
Try `setattr --help' or `setattr --usage' for more information.
|
|
== args must specify size and offline
|
|
setattr: must provide size if using --offline option
|
|
Try `setattr --help' or `setattr --usage' for more information.
|
|
== only works on regular files
|
|
failed to open '/mnt/test/test/setattr_more/dir': Is a directory (21)
|
|
scoutfs: setattr failed: Is a directory (21)
|
|
setattr_more ioctl failed on '/mnt/test/test/setattr_more/char': Inappropriate ioctl for device (25)
|
|
scoutfs: setattr failed: Inappropriate ioctl for device (25)
|
|
== non-zero file size fails
|
|
setattr_more ioctl failed on '/mnt/test/test/setattr_more/file': Invalid argument (22)
|
|
scoutfs: setattr failed: Invalid argument (22)
|
|
== non-zero file data_version fails
|
|
setattr_more ioctl failed on '/mnt/test/test/setattr_more/file': Invalid argument (22)
|
|
scoutfs: setattr failed: Invalid argument (22)
|
|
== large size is set
|
|
578437695752307201
|
|
== large data_version is set
|
|
578437695752307201
|
|
== large ctime is set
|
|
1972-02-19 00:06:25.999999999 +0000
|
|
== large offline extents are created
|
|
Filesystem type is: 554f4353
|
|
File size of /mnt/test/test/setattr_more/file is 40988672 (10007 blocks of 4096 bytes)
|
|
ext: logical_offset: physical_offset: length: expected: flags:
|
|
0: 0.. 10006: 0.. 10006: 10007: unknown,eof
|
|
/mnt/test/test/setattr_more/file: 1 extent found
|
|
== correct offline extent length
|
|
976563
|
|
== omitting data_version should not fail
|