On Wed, Dec 30, 2009 at 8:31 PM, Yehuda Sadeh Weinraub
<yehud...@gmail.com>wrote:

>
>
> On Wed, Dec 30, 2009 at 8:02 PM, Sage Weil <s...@newdream.net> wrote:
>
>>
>> BTW the corruption I was seeing was that the second page was written to
>> the first page (or something very close to that, possibly shifted by a
>> byte?).
>>
>
> I see the last page being written over the first one, also shifted by one
> byte. The rest of the pages are just garbage. Could be just a bug in the
> sync write related functions, wasn't able to isolate it yet.
>

Yes, the problem was in the copy_user_to_page_vector() helper function,
which was broken for the case where more than one page is involved. This has
only affected us in the synchronous write case, so it only happened with
multiple users. Just pushed a fix.

There is another issue I'm not sure about, which we should look at when we
audit the truncation code, and is whether we also need to update the
truncation size in the sync_write case, e.g., something along the line of:

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 2d88c80..910f970 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -631,6 +631,10 @@ static ssize_t ceph_sync_write(struct file *file, const
char __user *data,
         */
 more:
        len = left;
+
+       if (ci->i_truncate_size < pos + len)
+               ci->i_truncate_size = pos + len;
+
        req = ceph_osdc_new_request(&client->osdc, &ci->i_layout,
                                    ceph_vino(inode), pos, &len,
                                    CEPH_OSD_OP_WRITE, flags,


Yehuda
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ceph-devel mailing list
Ceph-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ceph-devel

Reply via email to