dm.c (436d41087d047b61f8ab0604dc74fff3240a8933) | dm.c (93c534aefb906824d71ea779ed0c7f1573843f4e) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 952 unchanged lines hidden (view full) --- 961 } 962} 963 964/* 965 * Swap in a new table (destroying old one). 966 */ 967int dm_swap_table(struct mapped_device *md, struct dm_table *table) 968{ | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 952 unchanged lines hidden (view full) --- 961 } 962} 963 964/* 965 * Swap in a new table (destroying old one). 966 */ 967int dm_swap_table(struct mapped_device *md, struct dm_table *table) 968{ |
969 int r; | 969 int r = -EINVAL; |
970 971 down_write(&md->lock); 972 973 /* device must be suspended */ | 970 971 down_write(&md->lock); 972 973 /* device must be suspended */ |
974 if (!test_bit(DMF_SUSPENDED, &md->flags)) { 975 up_write(&md->lock); 976 return -EPERM; 977 } | 974 if (!test_bit(DMF_SUSPENDED, &md->flags)) 975 goto out; |
978 979 __unbind(md); 980 r = __bind(md, table); | 976 977 __unbind(md); 978 r = __bind(md, table); |
981 if (r) 982 return r; | |
983 | 979 |
980out: |
|
984 up_write(&md->lock); | 981 up_write(&md->lock); |
985 return 0; | 982 return r; |
986} 987 988/* 989 * Functions to lock and unlock any filesystem running on the 990 * device. 991 */ 992static int __lock_fs(struct mapped_device *md) 993{ --- 219 unchanged lines hidden --- | 983} 984 985/* 986 * Functions to lock and unlock any filesystem running on the 987 * device. 988 */ 989static int __lock_fs(struct mapped_device *md) 990{ --- 219 unchanged lines hidden --- |