aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/stack_user.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-17 13:55:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-17 13:55:51 -0400
commit5b664cb235e97afbf34db9c4d77f08ebd725335e (patch)
tree518540649c38342209790de8e0b575ac1a6fa722 /fs/ocfs2/stack_user.c
parentf39548a6ad1dbdfaab552419386ec5bb1d76fa0d (diff)
parentc0420ad2ca514551ca086510b0e7d17a05c70492 (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: [PATCH] ocfs2: fix oops in mmap_truncate testing configfs: call drop_link() to cleanup after create_link() failure configfs: Allow ->make_item() and ->make_group() to return detailed errors. configfs: Fix failing mkdir() making racing rmdir() fail configfs: Fix deadlock with racing rmdir() and rename() configfs: Make configfs_new_dirent() return error code instead of NULL configfs: Protect configfs_dirent s_links list mutations configfs: Introduce configfs_dirent_lock ocfs2: Don't snprintf() without a format. ocfs2: Fix CONFIG_OCFS2_DEBUG_FS #ifdefs ocfs2/net: Silence build warnings on sparc64 ocfs2: Handle error during journal load ocfs2: Silence an error message in ocfs2_file_aio_read() ocfs2: use simple_read_from_buffer() ocfs2: fix printk format warnings with OCFS2_FS_STATS=n [PATCH 2/2] ocfs2: Instrument fs cluster locks [PATCH 1/2] ocfs2: Add CONFIG_OCFS2_FS_STATS config option
Diffstat (limited to 'fs/ocfs2/stack_user.c')
-rw-r--r--fs/ocfs2/stack_user.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index bd7e0f3acfc7..353fc35c6748 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -550,26 +550,17 @@ static ssize_t ocfs2_control_read(struct file *file,
550 size_t count, 550 size_t count,
551 loff_t *ppos) 551 loff_t *ppos)
552{ 552{
553 char *proto_string = OCFS2_CONTROL_PROTO; 553 ssize_t ret;
554 size_t to_write = 0;
555
556 if (*ppos >= OCFS2_CONTROL_PROTO_LEN)
557 return 0;
558
559 to_write = OCFS2_CONTROL_PROTO_LEN - *ppos;
560 if (to_write > count)
561 to_write = count;
562 if (copy_to_user(buf, proto_string + *ppos, to_write))
563 return -EFAULT;
564 554
565 *ppos += to_write; 555 ret = simple_read_from_buffer(buf, count, ppos,
556 OCFS2_CONTROL_PROTO, OCFS2_CONTROL_PROTO_LEN);
566 557
567 /* Have we read the whole protocol list? */ 558 /* Have we read the whole protocol list? */
568 if (*ppos >= OCFS2_CONTROL_PROTO_LEN) 559 if (ret > 0 && *ppos >= OCFS2_CONTROL_PROTO_LEN)
569 ocfs2_control_set_handshake_state(file, 560 ocfs2_control_set_handshake_state(file,
570 OCFS2_CONTROL_HANDSHAKE_READ); 561 OCFS2_CONTROL_HANDSHAKE_READ);
571 562
572 return to_write; 563 return ret;
573} 564}
574 565
575static int ocfs2_control_release(struct inode *inode, struct file *file) 566static int ocfs2_control_release(struct inode *inode, struct file *file)