All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] force luksClose
@ 2012-11-29 13:02 Benjamin Eberhardt
  2012-11-29 13:43 ` Matthias Schniedermeyer
  0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Eberhardt @ 2012-11-29 13:02 UTC (permalink / raw)
  To: dm-crypt

Dear dm-crypt developers,

since a while I am using dm-crypt with luks on usb-attached external
harddisks. Sometimes the usb connection breaks down and the harddisks
get reconnected under different device names. It is then impossible to
unmount (the "regular" way) and luksClose the "old" device which is
still active. For unmounting i can use the "-l" "lazy" switch to kind
of force unmounting of the luks'ed filesystem even though it is still
"busy". A luksClose of the device although is impossible and the only
way i know so far is to reboot the machine. Is it possible to
implement some kind of lazy luksClose so that "dead" devices of which
the physical layer has dissappeared can be removed?

Thank you,
Benjamin

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [dm-crypt] force luksClose
@ 2015-11-29 18:42 yac
  0 siblings, 0 replies; 12+ messages in thread
From: yac @ 2015-11-29 18:42 UTC (permalink / raw)
  To: dm-crypt

Hello

I believe I have the same problem as described here:
http://comments.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/6250

Here are the last requested commands:

# dmsetup table dlt
0 4096 crypt aes-xts-plain64 0000000000000000000000000000000000000000000000000000000000000000 0 254:8 4096
# dmsetup info -c dlt
Name             Maj Min Stat Open Targ Event  UUID                                            
dlt              254   9 L--w    1    1      0 CRYPT-LUKS1-731df69c78e94882982899390c71bb3b-dlt
# lsblk 
lsblk: dm-0: failed to get device path
lsblk: dm-0: failed to get device path
NAME                MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                   8:0    0  1.8T  0 disk  
└─sda1                8:1    0  1.8T  0 part  
sdb                   8:16   0  2.7T  0 disk  
└─sdb1                8:17   0  2.7T  0 part  
sdc                   8:32   0  2.7T  0 disk  
└─sdc1                8:33   0  2.7T  0 part  
sdd                   8:48   0  2.7T  0 disk  
└─sdd1                8:49   0  2.7T  0 part  
sde                   8:64   0  2.7T  0 disk  
└─sde1                8:65   0  2.7T  0 part  
sdf                   8:80   0  1.8T  0 disk  
sdg                   8:96   1  3.8G  0 disk  
└─sdg1                8:97   1  3.8G  0 part  
loop8                 7:8    0   10M  0 loop  
├─lt-lvol0_rmeta_0  254:4    0    4M  0 lvm   
│ └─lt-lvol0        254:8    0    4M  0 lvm   
│   └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt
└─lt-lvol0_rimage_0 254:5    0   12M  0 lvm   
  └─lt-lvol0        254:8    0    4M  0 lvm   
    └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt
loop9                 7:9    0   10M  0 loop  
├─lt-lvol0_rmeta_1  254:6    0    4M  0 lvm   
│ └─lt-lvol0        254:8    0    4M  0 lvm   
│   └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt
└─lt-lvol0_rimage_1 254:7    0   12M  0 lvm   
  └─lt-lvol0        254:8    0    4M  0 lvm   
    └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt
loop10                7:10   0   10M  0 loop  
└─lt-lvol0_rimage_0 254:5    0   12M  0 lvm   
  └─lt-lvol0        254:8    0    4M  0 lvm   
    └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt
loop11                7:11   0   10M  0 loop  
└─lt-lvol0_rimage_1 254:7    0   12M  0 lvm   
  └─lt-lvol0        254:8    0    4M  0 lvm   
    └─dlt           254:9    0    2M  0 crypt /root/lvm-crypt-test/mnt



This happened to me after I was trying out lvm and then crypt on top
lvm. First, let's have a workspace

# cd /root; mkdir lvm-crypt-test; cd lvm-crypt-test

Fake some block devs

# mknod /dev/lta b 7 8
# mknod /dev/ltb b 7 9
# mknod /dev/ltc b 7 10 
# mknod /dev/ltd b 7 11
# for i in a b c d; do fallocate -l 10M sd$i; losetup /dev/lt$i sd$i; done

Make an LVM raid1

# pvcreate /dev/lt{a,b,c,d}
# vgcreate lt /dev/lt{a,b,c,d}
# lvcreate -m1 -l 100%VG lt /dev/lt{a,b}

Encrypt it

# echo "aaa" > key
# cryptsetup luksFormat /dev/lt/lvol0 -d key

Format and mount

# cryptsetup luksOpen /dev/lt/lvol0 -d key dlt
# mkfs.ext4 /dev/mapper/dlt
# mkdir ./mnt; mount /dev/mapper/dlt ./mnt

Now comes the part where I broke it

# lvextend /dev/lt/lvol0 /dev/lt{c,d} -l 100%VG

I tried to umount mnt but it got stuck in uninterruptible sleep. But
umount -l worked for me.

# cat /proc/mounts  | grep dlt
# cat /proc/mounts  | grep mnt
# 

But I am not able to anything about dlt and the underlying devices. Not
even turn the system off normally as that gets stuck on sync().

# ps auxf | grep D
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     15193  0.0  0.0  27488  4436 ?        D    01:03   0:00 lvs
root     15196  0.0  0.0  27472  4432 ?        D    01:04   0:00 lvdisplay
root     15201  0.0  0.0  12612  2300 ?        D    01:04   0:00 umount mnt/
root     15237  0.0  0.0  12564  1740 ?        D    01:06   0:00 shutdown -h 0 w
root     15372  0.0  0.0   5840   748 ?        D    01:12   0:00 sync
root     17287  0.0  0.0   4016   640 ?        D    01:50   0:00 /sbin/reboot -f
root     17296  0.0  0.0  12576  2512 ?        D    01:51   0:00 dmsetup remove -f dlt
root     25471  0.0  0.0  27480  4532 ?        D    02:05   0:00 lvchange -an /dev/lt/lvol0
root     25529  0.0  0.0  24008  5576 ?        D<L  02:15   0:00 cryptsetup luksClose dlt
root     26114  0.0  0.0  24008  5576 ?        D<L  03:21   0:00 cryptsetup loopaesClose dlt

# lsof /root/lvm-crypt-test/mnt/
# fuser /root/lvm-crypt-test/mnt/
# find /proc/ -maxdepth 2 -type l -name cwd -exec readlink {} \; | sort | uniq
/
/proc/26289
/root
/root/lvm-crypt-test
/sys


Luckily I was able to umount and luksClose all the real block devices
there and now it appears my only option is to go pull the plug.

Best regards
Jan Matejka

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [dm-crypt] Force luksClose
@ 2012-10-23  4:51 Dennis Birkholz
  2012-10-25 10:01 ` Milan Broz
  0 siblings, 1 reply; 12+ messages in thread
From: Dennis Birkholz @ 2012-10-23  4:51 UTC (permalink / raw)
  To: dm-crypt

Hello together,

I am using a crypt mapping on a Software-RAID5. As my raid crashed (2 of
5 drives disappeared), I was not able to remove the crypt mapping
because the raid device was not accessible any more. It would be nice to
have a force option so the mapping is removed and I can stop the
degraded raid. The only option was to reboot which is not a very good
solution.

Greets,
Dennis

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-11-29 18:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29 13:02 [dm-crypt] force luksClose Benjamin Eberhardt
2012-11-29 13:43 ` Matthias Schniedermeyer
2012-11-29 14:53   ` Milan Broz
2012-12-25 12:17     ` Benjamin Eberhardt
2013-02-21 21:16       ` Benjamin Eberhardt
2013-02-21 22:08         ` Matthias Schniedermeyer
2013-02-21 22:41         ` Milan Broz
2013-02-22  0:17           ` Benjamin Eberhardt
  -- strict thread matches above, loose matches on Subject: below --
2015-11-29 18:42 yac
2012-10-23  4:51 [dm-crypt] Force luksClose Dennis Birkholz
2012-10-25 10:01 ` Milan Broz
2012-10-25 14:46   ` Dennis Birkholz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.