Couple of efivarfs fixes
Subsystems (2)
cover Couple of efivarfs fixes
1) Some apps want to monitor changes in EFI variables, but reading the file and comparing is inefficient. Just have Linnux update the modification time when a file is written
2) A rate limited read can return -EINTR ... very suprising to apps.
Tony Luck (2):
efivarfs: Update inode modification time for successful writes
efivarfs: Don't return -EINTR when rate-limiting reads
fs/efivarfs/file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.1
PATCH 1/2 efivarfs: Update inode modification time for successful writes
Some applications want to be able to see when EFI variables have been updated.
Update the modification time for successful writes.
--- fs/efivarfs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/efivarfs/file.c +1 -0
@@ -51,6 +51,7 @@ static ssize_t efivarfs_file_write(struct file *file, }else {inode_lock (inode);i_size_write (inode, datasize +sizeof (attributes)); + inode->i_mtime =current_time (inode);inode_unlock (inode); }
Signature · 1 line
2.21.1
[tip: efi/urgent] efivarfs: Update inode modification time for successful writes
The following commit has been merged into the efi/urgent branch of tip:
The following commit has been merged into the efi/urgent branch of tip:
Commit-ID: 2096721f1577b51b574fa06a7d91823dffe7267a Gitweb: https://git.kernel.org/tip/2096721f1577b51b574fa06a7d91823dffe7267a Author: Tony Luck <[email protected]> AuthorDate: Thu, 28 May 2020 12:49:04 -07:00 Committer: Ard Biesheuvel <[email protected]> CommitterDate: Mon, 15 Jun 2020 14:38:56 +02:00
efivarfs: Update inode modification time for successful writes
Some applications want to be able to see when EFI variables have been updated.
Update the modification time for successful writes.
--- fs/efivarfs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/efivarfs/file.c +1 -0
@@ -51,6 +51,7 @@ static ssize_t efivarfs_file_write(struct file *file, }else {inode_lock (inode);i_size_write (inode, datasize +sizeof (attributes)); + inode->i_mtime =current_time (inode);inode_unlock (inode); }
PATCH 2/2 efivarfs: Don't return -EINTR when rate-limiting reads
In reply to Tony LuckApplications that read EFI variables may see a return value of -EINTR if they exceed the rate limit and a signal delivery is attempted while the process is sleeping.
This is quite surprising to the application, which probably doesn't have code to handle it.
Change the interruptible sleep to a non-interruptible one.
--- fs/efivarfs/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/efivarfs/file.c +2 -4
@@ -73,10 +73,8 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,ssize_t size =0 ;int err; -while (!__ratelimit (&file->f_cred->user->ratelimit)) { -if (!msleep_interruptible (50 )) -return -EINTR ; - } +while (!__ratelimit (&file->f_cred->user->ratelimit)) +msleep (50 ); err =efivar_entry_size (var, &datasize);
Signature · 1 line
2.21.1
[tip: efi/urgent] efivarfs: Don't return -EINTR when rate-limiting reads
The following commit has been merged into the efi/urgent branch of tip:
The following commit has been merged into the efi/urgent branch of tip:
Commit-ID: 4353f03317fd3eb0bd803b61bdb287b68736a728 Gitweb: https://git.kernel.org/tip/4353f03317fd3eb0bd803b61bdb287b68736a728 Author: Tony Luck <[email protected]> AuthorDate: Thu, 28 May 2020 12:49:05 -07:00 Committer: Ard Biesheuvel <[email protected]> CommitterDate: Mon, 15 Jun 2020 14:38:56 +02:00
efivarfs: Don't return -EINTR when rate-limiting reads
Applications that read EFI variables may see a return value of -EINTR if they exceed the rate limit and a signal delivery is attempted while the process is sleeping.
This is quite surprising to the application, which probably doesn't have code to handle it.
Change the interruptible sleep to a non-interruptible one.
--- fs/efivarfs/file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/efivarfs/file.c +2 -4
@@ -73,10 +73,8 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf,ssize_t size =0 ;int err; -while (!__ratelimit (&file->f_cred->user->ratelimit)) { -if (!msleep_interruptible (50 )) -return -EINTR ; - } +while (!__ratelimit (&file->f_cred->user->ratelimit)) +msleep (50 ); err =efivar_entry_size (var, &datasize);
Ard Biesheuvel
maintainerQuoted 5 lines · Tony Luck
1) Some apps want to monitor changes in EFI variables, but reading the file and comparing is inefficient. Just have Linnux update the modification time when a file is written
Quoted 9 lines
2) A rate limited read can return
-EINTR... very suprising to apps.Tony Luck (2):
efivarfs: Update inode modification time for successful writes
efivarfs: Don't return-EINTRwhen rate-limiting readsfs/efivarfs/file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Queued in efi/urgent
Thanks,