mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-11 09:18:25 +03:00
Fix allocation & list-handling.
This commit is contained in:
parent
d8cffcaae7
commit
c2866e799d
@ -105,10 +105,10 @@ static struct block_device *dm_get_device(struct block_device *bdev)
|
|||||||
|
|
||||||
|
|
||||||
if (!d) {
|
if (!d) {
|
||||||
rv = blkdev_get(d->bdev, FMODE_READ | FMODE_WRITE, 0, BDEV_FILE);
|
rv = blkdev_get(bdev, FMODE_READ | FMODE_WRITE, 0, BDEV_FILE);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
write_lock(&bdev_lock);
|
write_lock(&bdev_lock);
|
||||||
list_add(&bdev_hash[hash], &n->list);
|
list_add(&n->list, &bdev_hash[hash]);
|
||||||
d = n;
|
d = n;
|
||||||
n = NULL;
|
n = NULL;
|
||||||
write_unlock(&bdev_lock);
|
write_unlock(&bdev_lock);
|
||||||
@ -152,7 +152,12 @@ struct block_device *dm_blkdev_get(const char *path)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Versions? */
|
||||||
|
#ifdef MNT_NODEV
|
||||||
if (nd.mnt->mnt_flags & MNT_NODEV) {
|
if (nd.mnt->mnt_flags & MNT_NODEV) {
|
||||||
|
#else
|
||||||
|
if (IS_NODEV(inode)) {
|
||||||
|
#endif
|
||||||
bdev = ERR_PTR(-EACCES);
|
bdev = ERR_PTR(-EACCES);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -96,13 +96,20 @@ int extract_line(struct text_region *line, void *private)
|
|||||||
static struct file *open_error_file(struct file *table)
|
static struct file *open_error_file(struct file *table)
|
||||||
{
|
{
|
||||||
struct file *f;
|
struct file *f;
|
||||||
char *name, *buffer = (char *) kmalloc(PATH_MAX + 1, GFP_KERNEL);
|
char *name, *buffer;
|
||||||
|
int bufsize = PATH_MAX + 1;
|
||||||
|
|
||||||
|
if (bufsize < PAGE_SIZE)
|
||||||
|
bufsize = PAGE_SIZE;
|
||||||
|
|
||||||
|
/* Get space to append ".err" */
|
||||||
|
buffer = (char *) kmalloc(bufsize + 4, GFP_KERNEL);
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Get path name */
|
/* Get path name */
|
||||||
name = d_path(table->f_dentry, table->f_vfsmnt, buffer, PATH_MAX + 1);
|
name = d_path(table->f_dentry, table->f_vfsmnt, buffer, bufsize);
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user