chmod of active swap file blocks

From: Paul Jakma
Date: Sun Dec 28 2003 - 23:56:38 EST


Hi,

Trying to chmod a file being used for swap causes chmod() to block,
with permissions change /not/ having taken effect, until the swap
file is swapoff'd, at which point chmod() carries on and chmod (the
command) finishes.

# swapon /.swapfile
# cat /proc/swaps
Filename Type Size Used Priority
/dev/ide/host0/bus0/target0/lun0/part1 partition 200772 51748 -1
/.swapfile file 131064 0 -5
# strace chmod g-w /.swapfile 2> /tmp/strace-chmod &
[3] 29208
# tail /tmp/strace-chmod
[ snip ]
stat64("/.swapfile", {st_mode=S_IFREG|0600, st_size=134217728, ...}) = 0
chmod("/.swapfile", 0600
# swapoff /.swapfile
#
[3] Done strace chmod g-w /.swapfile 2>/tmp/strace-chmod

NB: no, i dont use devfs :) (just same namespace.)

regards,
--
Paul Jakma paul@xxxxxxxx paul@xxxxxxxxx Key ID: 64A2FF6A
warning: do not ever send email to spam@xxxxxxxxxx
Fortune:
Save energy: Drive a smaller shell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/