1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix allocation & list-handling.

This commit is contained in:
Alasdair Kergon 2001-09-18 20:03:00 +00:00
parent a71f36113c
commit 25f2335b7d
2 changed files with 16 additions and 4 deletions

View File

@ -105,10 +105,10 @@ static struct block_device *dm_get_device(struct block_device *bdev)
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) {
write_lock(&bdev_lock);
list_add(&bdev_hash[hash], &n->list);
list_add(&n->list, &bdev_hash[hash]);
d = n;
n = NULL;
write_unlock(&bdev_lock);
@ -152,7 +152,12 @@ struct block_device *dm_blkdev_get(const char *path)
goto out;
}
/* Versions? */
#ifdef MNT_NODEV
if (nd.mnt->mnt_flags & MNT_NODEV) {
#else
if (IS_NODEV(inode)) {
#endif
bdev = ERR_PTR(-EACCES);
goto out;
}

View File

@ -96,13 +96,20 @@ int extract_line(struct text_region *line, void *private)
static struct file *open_error_file(struct file *table)
{
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)
return 0;
/* 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) {
kfree(buffer);