From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Steve French" Subject: Re: Fwd: fsx-linux failing with latest cifs-2.6 git tree Date: Fri, 21 Nov 2008 14:38:18 -0600 Message-ID: <524f69650811211238x3c81d899r225f46776aeb52f1@mail.gmail.com> References: <20081121105613.09a8cb8e@tleilax.poochiereds.net> <524f69650811210820s549de2bah3181cbc0c5633091@mail.gmail.com> <20081121112249.0b408b55@tleilax.poochiereds.net> <524f69650811210846q7502fd99m6f4d335bb6ac1b65@mail.gmail.com> <524f69650811211109w659e5decoa34a8e0f907772a3@mail.gmail.com> <524f69650811211113q4fffcc70of88cb85db531c358@mail.gmail.com> <1227296476.20845.8.camel@norville.austin.ibm.com> <524f69650811211218v78295682lcf6dce842327b097@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_137415_15174121.1227299898820" Cc: Nick Piggin , linux-fsdevel , pbadari@us.ibm.com, Jeff Layton , "linux-cifs-client@lists.samba.org" To: "Dave Kleikamp" Return-path: In-Reply-To: <524f69650811211218v78295682lcf6dce842327b097@mail.gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org Errors-To: linux-cifs-client-bounces+glfc-linux-cifs-client=gmane.org@lists.samba.org List-Id: linux-fsdevel.vger.kernel.org ------=_Part_137415_15174121.1227299898820 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Fix attached. Shaggy/Jeff/Nick etc. do you want to review/ack it since it is late in the rc? On Fri, Nov 21, 2008 at 2:18 PM, Steve French wrote: > Looks like the following change to cifs_write_begin does fix it ... > thanks Shaggy ... > > @@ -2062,8 +2074,10 @@ static int cifs_write_begin(struct file *file, > struct address_space *mapping, > { > pgoff_t index = pos >> PAGE_CACHE_SHIFT; > loff_t offset = pos & (PAGE_CACHE_SIZE - 1); > + loff_t page_start = pos & PAGE_MASK; > > cFYI(1, ("write_begin from %lld len %d", (long long)pos, len)); > @@ -2081,13 +2095,14 @@ static int cifs_write_begin(struct file *file, > struct address_space *mapping, > int rc; > > /* might as well read a page, it is fast enough */ > - rc = cifs_readpage_worker(file, *pagep, &offset); > + rc = cifs_readpage_worker(file, *pagep, &page_start); > > /* we do not need to pass errors back > e.g. if we do not have read access to the file > because cifs_write_end will attempt synchronous writes > -- shaggy */ > > > On Fri, Nov 21, 2008 at 1:41 PM, Dave Kleikamp > wrote: >> On Fri, 2008-11-21 at 13:13 -0600, Steve French wrote: >>> Looks like this section of code is wrong in cifs_write_begin: >>> >>> if ((file->f_flags & O_ACCMODE) != O_WRONLY) { >>> int rc; >>> >>> /* might as well read a page, it is fast enough */ >>> rc = cifs_readpage_worker(file, *pagep, &offset); >>> >>> /* we do not need to pass errors back >>> e.g. if we do not have read access to the file >>> because cifs_write_end will attempt synchronous writes >>> -- shaggy */ >>> >>> >>> We see a case in which a write begins at offset 0x2e42f but the range >>> immediately before it is unitialized in write_begin >>> >>> shouldn't we be doing a read of the whole page? >> >> What cifs_write_begin() passes in as offset is completely wrong. It >> should be the file offset of the beginning of the page rather than some >> offset within the page. >> -- >> David Kleikamp >> IBM Linux Technology Center >> >> > > > > -- > Thanks, > > Steve > -- Thanks, Steve ------=_Part_137415_15174121.1227299898820 Content-Type: text/x-diff; name=fsx-fail-fix.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_fntanjji0 Content-Disposition: attachment; filename=fsx-fail-fix.patch ZGlmZiAtLWdpdCBhL2ZzL2NpZnMvZmlsZS5jIGIvZnMvY2lmcy9maWxlLmMKaW5kZXggYjY5MWI4 OS4uNzI2ZDQzNyAxMDA2NDQKLS0tIGEvZnMvY2lmcy9maWxlLmMKKysrIGIvZnMvY2lmcy9maWxl LmMKQEAgLTIwNjEsNyArMjA2MSw3IEBAIHN0YXRpYyBpbnQgY2lmc193cml0ZV9iZWdpbihzdHJ1 Y3QgZmlsZSAqZmlsZSwgc3RydWN0IGFkZHJlc3Nfc3BhY2UgKm1hcHBpbmcsCiAJCQlzdHJ1Y3Qg cGFnZSAqKnBhZ2VwLCB2b2lkICoqZnNkYXRhKQogewogCXBnb2ZmX3QgaW5kZXggPSBwb3MgPj4g UEFHRV9DQUNIRV9TSElGVDsKLQlsb2ZmX3Qgb2Zmc2V0ID0gcG9zICYgKFBBR0VfQ0FDSEVfU0la RSAtIDEpOworCWxvZmZfdCBvZmZzZXRfb2ZfcGFnZV9zdGFydCA9IHBvcyAmIFBBR0VfTUFTSzsK IAogCWNGWUkoMSwgKCJ3cml0ZV9iZWdpbiBmcm9tICVsbGQgbGVuICVkIiwgKGxvbmcgbG9uZylw b3MsIGxlbikpOwogCkBAIC0yMDgxLDcgKzIwODEsNyBAQCBzdGF0aWMgaW50IGNpZnNfd3JpdGVf YmVnaW4oc3RydWN0IGZpbGUgKmZpbGUsIHN0cnVjdCBhZGRyZXNzX3NwYWNlICptYXBwaW5nLAog CQlpbnQgcmM7CiAKIAkJLyogbWlnaHQgYXMgd2VsbCByZWFkIGEgcGFnZSwgaXQgaXMgZmFzdCBl bm91Z2ggKi8KLQkJcmMgPSBjaWZzX3JlYWRwYWdlX3dvcmtlcihmaWxlLCAqcGFnZXAsICZvZmZz ZXQpOworCQlyYyA9IGNpZnNfcmVhZHBhZ2Vfd29ya2VyKGZpbGUsICpwYWdlcCwgJm9mZnNldF9v Zl9wYWdlX3N0YXJ0KTsKIAogCQkvKiB3ZSBkbyBub3QgbmVlZCB0byBwYXNzIGVycm9ycyBiYWNr CiAJCSAgIGUuZy4gaWYgd2UgZG8gbm90IGhhdmUgcmVhZCBhY2Nlc3MgdG8gdGhlIGZpbGUK ------=_Part_137415_15174121.1227299898820 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-cifs-client mailing list linux-cifs-client@lists.samba.org https://lists.samba.org/mailman/listinfo/linux-cifs-client ------=_Part_137415_15174121.1227299898820--