Skip to content

Commit

Permalink
Merge branch 'akpm' (incoming from Andrew)
Browse files Browse the repository at this point in the history
Merge a few more patches from Andrew Morton:
 "A few leftovers"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  fs/ncpfs/dir.c: fix indenting in ncp_lookup()
  ncpfs/inode.c: fix mismatch printk formats and arguments
  ncpfs: remove now unused PRINTK macro
  ncpfs: convert PPRINTK to ncp_vdbg
  ncpfs: convert DPRINTK/DDPRINTK to ncp_dbg
  ncpfs: Add pr_fmt and convert printks to pr_<level>
  arch/x86/mm/kmemcheck/kmemcheck.c: use kstrtoint() instead of sscanf()
  lib/percpu_counter.c: fix bad percpu counter state during suspend
  autofs4: check dev ioctl size before allocating
  mm: vmscan: do not swap anon pages just because free+file is low
  • Loading branch information
Linus Torvalds committed Apr 8, 2014
2 parents ce7613d + ffddc5f commit 0f386a7
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 150 deletions.
8 changes: 7 additions & 1 deletion arch/x86/mm/kmemcheck/kmemcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ early_initcall(kmemcheck_init);
*/
static int __init param_kmemcheck(char *str)
{
int val;
int ret;

if (!str)
return -EINVAL;

sscanf(str, "%d", &kmemcheck_enabled);
ret = kstrtoint(str, 0, &val);
if (ret)
return ret;
kmemcheck_enabled = val;
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions fs/autofs4/dev-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
if (tmp.size < sizeof(tmp))
return ERR_PTR(-EINVAL);

if (tmp.size > (PATH_MAX + sizeof(tmp)))
return ERR_PTR(-ENAMETOOLONG);

return memdup_user(in, tmp.size);
}

Expand Down
69 changes: 32 additions & 37 deletions fs/ncpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
if (val)
goto finished;

DDPRINTK("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n",
ncp_dbg(2, "%pd2 not valid, age=%ld, server lookup\n",
dentry, NCP_GET_AGE(dentry));

len = sizeof(__name);
Expand All @@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
finfo.volume = finfo.i.volNumber;
DDPRINTK("ncp_lookup_validate: looked for %pd/%s, res=%d\n",
ncp_dbg(2, "looked for %pd/%s, res=%d\n",
dentry->d_parent, __name, res);
/*
* If we didn't find it, or if it has a different dirEntNum to
Expand All @@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
ncp_new_dentry(dentry);
val=1;
} else
DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n");
ncp_dbg(2, "found, but dirEntNum changed\n");

ncp_update_inode2(inode, &finfo);
mutex_unlock(&inode->i_mutex);
}

finished:
DDPRINTK("ncp_lookup_validate: result=%d\n", val);
ncp_dbg(2, "result=%d\n", val);
dput(parent);
return val;
}
Expand Down Expand Up @@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
ctl.page = NULL;
ctl.cache = NULL;

DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file,
(int) ctx->pos);
ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);

result = -EIO;
/* Do not generate '.' and '..' when server is dead. */
Expand Down Expand Up @@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
struct ncp_entry_info entry;
int i;

DPRINTK("ncp_read_volume_list: pos=%ld\n",
(unsigned long) ctx->pos);
ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);

for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
int inval_dentry;
Expand All @@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
if (!strlen(info.volume_name))
continue;

DPRINTK("ncp_read_volume_list: found vol: %s\n",
info.volume_name);
ncp_dbg(1, "found vol: %s\n", info.volume_name);

if (ncp_lookup_volume(server, info.volume_name,
&entry.i)) {
DPRINTK("ncpfs: could not lookup vol %s\n",
ncp_dbg(1, "could not lookup vol %s\n",
info.volume_name);
continue;
}
Expand All @@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,
int more;
size_t bufsize;

DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file,
(unsigned long) ctx->pos);
PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n",
file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
ncp_vdbg("init %pD, volnum=%d, dirent=%u\n",
file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);

err = ncp_initialize_search(server, dir, &seq);
if (err) {
DPRINTK("ncp_do_readdir: init failed, err=%d\n", err);
ncp_dbg(1, "init failed, err=%d\n", err);
return;
}
/* We MUST NOT use server->buffer_size handshaked with server if we are
Expand Down Expand Up @@ -808,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb)
goto out;
result = -ENOENT;
if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) {
PPRINTK("ncp_conn_logged_in: %s not found\n",
server->m.mounted_vol);
ncp_vdbg("%s not found\n", server->m.mounted_vol);
goto out;
}
dent = sb->s_root;
Expand All @@ -822,10 +817,10 @@ int ncp_conn_logged_in(struct super_block *sb)
NCP_FINFO(ino)->DosDirNum = DosDirNum;
result = 0;
} else {
DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n");
ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
}
} else {
DPRINTK("ncpfs: sb->s_root == NULL!\n");
ncp_dbg(1, "sb->s_root == NULL!\n");
}
} else
result = 0;
Expand All @@ -846,23 +841,23 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
if (!ncp_conn_valid(server))
goto finished;

PPRINTK("ncp_lookup: server lookup for %pd2\n", dentry);
ncp_vdbg("server lookup for %pd2\n", dentry);

len = sizeof(__name);
if (ncp_is_server_root(dir)) {
res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
dentry->d_name.len, 1);
if (!res)
res = ncp_lookup_volume(server, __name, &(finfo.i));
if (!res)
ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
if (!res)
ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
} else {
res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
dentry->d_name.len, !ncp_preserve_case(dir));
if (!res)
res = ncp_obtain_info(server, dir, __name, &(finfo.i));
}
PPRINTK("ncp_lookup: looked for %pd2, res=%d\n", dentry, res);
ncp_vdbg("looked for %pd2, res=%d\n", dentry, res);
/*
* If we didn't find an entry, make a negative dentry.
*/
Expand All @@ -886,7 +881,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
}

finished:
PPRINTK("ncp_lookup: result=%d\n", error);
ncp_vdbg("result=%d\n", error);
return ERR_PTR(error);
}

Expand All @@ -909,7 +904,7 @@ static int ncp_instantiate(struct inode *dir, struct dentry *dentry,
return error;

out_close:
PPRINTK("ncp_instantiate: %pd2 failed, closing file\n", dentry);
ncp_vdbg("%pd2 failed, closing file\n", dentry);
ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
goto out;
}
Expand All @@ -923,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
int opmode;
__u8 __name[NCP_MAXPATHLEN + 1];

PPRINTK("ncp_create_new: creating %pd2, mode=%hx\n", dentry, mode);
ncp_vdbg("creating %pd2, mode=%hx\n", dentry, mode);

ncp_age_dentry(server, dentry);
len = sizeof(__name);
Expand Down Expand Up @@ -952,7 +947,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
error = -ENAMETOOLONG;
else if (result < 0)
error = result;
DPRINTK("ncp_create: %pd2 failed\n", dentry);
ncp_dbg(1, "%pd2 failed\n", dentry);
goto out;
}
opmode = O_WRONLY;
Expand Down Expand Up @@ -985,7 +980,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
int error, len;
__u8 __name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_mkdir: making %pd2\n", dentry);
ncp_dbg(1, "making %pd2\n", dentry);

ncp_age_dentry(server, dentry);
len = sizeof(__name);
Expand Down Expand Up @@ -1022,7 +1017,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
int error, result, len;
__u8 __name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_rmdir: removing %pd2\n", dentry);
ncp_dbg(1, "removing %pd2\n", dentry);

len = sizeof(__name);
error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
Expand Down Expand Up @@ -1067,13 +1062,13 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
int error;

server = NCP_SERVER(dir);
DPRINTK("ncp_unlink: unlinking %pd2\n", dentry);
ncp_dbg(1, "unlinking %pd2\n", dentry);

/*
* Check whether to close the file ...
*/
if (inode) {
PPRINTK("ncp_unlink: closing file\n");
ncp_vdbg("closing file\n");
ncp_make_closed(inode);
}

Expand All @@ -1087,7 +1082,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
#endif
switch (error) {
case 0x00:
DPRINTK("ncp: removed %pd2\n", dentry);
ncp_dbg(1, "removed %pd2\n", dentry);
break;
case 0x85:
case 0x8A:
Expand Down Expand Up @@ -1120,7 +1115,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
int old_len, new_len;
__u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];

DPRINTK("ncp_rename: %pd2 to %pd2\n", old_dentry, new_dentry);
ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);

ncp_age_dentry(server, old_dentry);
ncp_age_dentry(server, new_dentry);
Expand Down Expand Up @@ -1150,8 +1145,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
#endif
switch (error) {
case 0x00:
DPRINTK("ncp renamed %pd -> %pd.\n",
old_dentry, new_dentry);
ncp_dbg(1, "renamed %pd -> %pd\n",
old_dentry, new_dentry);
break;
case 0x9E:
error = -ENAMETOOLONG;
Expand All @@ -1173,7 +1168,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,
if (!new_valid_dev(rdev))
return -EINVAL;
if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode);
ncp_dbg(1, "mode = 0%ho\n", mode);
return ncp_create_new(dir, dentry, mode, rdev, 0);
}
return -EPERM; /* Strange, but true */
Expand Down
24 changes: 13 additions & 11 deletions fs/ncpfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <asm/uaccess.h>

#include <linux/time.h>
Expand Down Expand Up @@ -34,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right)

error = -EINVAL;
if (!inode) {
printk(KERN_ERR "ncp_make_open: got NULL inode\n");
pr_err("%s: got NULL inode\n", __func__);
goto out;
}

DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n",
ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",
atomic_read(&NCP_FINFO(inode)->opened),
NCP_FINFO(inode)->volNumber,
NCP_FINFO(inode)->dirEntNum);
Expand Down Expand Up @@ -71,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)
break;
}
if (result) {
PPRINTK("ncp_make_open: failed, result=%d\n", result);
ncp_vdbg("failed, result=%d\n", result);
goto out_unlock;
}
/*
Expand All @@ -83,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right)
}

access = NCP_FINFO(inode)->access;
PPRINTK("ncp_make_open: file open, access=%x\n", access);
ncp_vdbg("file open, access=%x\n", access);
if (access == right || access == O_RDWR) {
atomic_inc(&NCP_FINFO(inode)->opened);
error = 0;
Expand All @@ -107,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
void* freepage;
size_t freelen;

DPRINTK("ncp_file_read: enter %pd2\n", dentry);
ncp_dbg(1, "enter %pd2\n", dentry);

pos = *ppos;

Expand All @@ -124,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

error = ncp_make_open(inode, O_RDONLY);
if (error) {
DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error);
ncp_dbg(1, "open failed, error=%d\n", error);
return error;
}

Expand Down Expand Up @@ -165,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

file_accessed(file);

DPRINTK("ncp_file_read: exit %pd2\n", dentry);
ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
ncp_inode_close(inode);
return already_read ? already_read : error;
Expand All @@ -182,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
int errno;
void* bouncebuffer;

DPRINTK("ncp_file_write: enter %pd2\n", dentry);
ncp_dbg(1, "enter %pd2\n", dentry);
if ((ssize_t) count < 0)
return -EINVAL;
pos = *ppos;
Expand Down Expand Up @@ -211,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
return 0;
errno = ncp_make_open(inode, O_WRONLY);
if (errno) {
DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
ncp_dbg(1, "open failed, error=%d\n", errno);
return errno;
}
bufsize = NCP_SERVER(inode)->buffer_size;
Expand Down Expand Up @@ -261,15 +263,15 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
i_size_write(inode, pos);
mutex_unlock(&inode->i_mutex);
}
DPRINTK("ncp_file_write: exit %pd2\n", dentry);
ncp_dbg(1, "exit %pd2\n", dentry);
outrel:
ncp_inode_close(inode);
return already_written ? already_written : errno;
}

static int ncp_release(struct inode *inode, struct file *file) {
if (ncp_make_closed(inode)) {
DPRINTK("ncp_release: failed to close\n");
ncp_dbg(1, "failed to close\n");
}
return 0;
}
Expand Down
Loading

0 comments on commit 0f386a7

Please sign in to comment.