Re: [PATCH] open.2: document more -ETXTBSY conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jann,

On 03/20/2018 02:14 AM, Jann Horn wrote:
> The first one happens in
> do_filp_open -> path_openat -> do_last -> handle_truncate -> do_truncate
> -> notify_change -> simple_setattr -> setattr_prepare -> inode_newsize_ok.
> 
> Demo:
> 
> # dd if=/dev/zero of=/x bs=102400 count=1024
> [...]
> # mkswap /x && swapon /x
> [...]
> # strace dd if=/dev/zero of=/x count=1
> [...]
> open("/x", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ETXTBSY (Text file busy)
> [...]
> # strace dd if=/dev/zero of=/x count=1 conv=notrunc
> [...]
> open("/x", O_WRONLY|O_CREAT, 0666)      = 3
> dup2(3, 1)                              = 1
> close(3)                                = 0
> read(0, "\0\0\0\0[...]"..., 512) = 512
> write(1, "\0\0\0\0[...]"..., 512) = 512
> [...]
> #
> 
> The second one is in kernel_read_file -> deny_write_access.

Thanks, patch applied.

Cheers,

Michael

> Signed-off-by: Jann Horn <jannh@xxxxxxxxxx>
> ---
>  man2/open.2 | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/man2/open.2 b/man2/open.2
> index 4a43f32e0..858eb2660 100644
> --- a/man2/open.2
> +++ b/man2/open.2
> @@ -1159,6 +1159,17 @@ requested.
>  refers to an executable image which is currently being executed and
>  write access was requested.
>  .TP
> +.B ETXTBSY
> +.I pathname
> +refers to a file that is currently in use as a swap file, and the
> +.B O_TRUNC
> +flag was specified.
> +.TP
> +.B ETXTBSY
> +.I pathname
> +refers to a file that is currently being read by the kernel (e.g. for
> +module/firmware loading), and write access was requested.
> +.TP
>  .B EWOULDBLOCK
>  The
>  .B O_NONBLOCK
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux