Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 23 Jan 2003 16:55:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 23 Jan 2003 16:55:25 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.106]:9196 "EHLO e6.ny.us.ibm.com") by vger.kernel.org with ESMTP id ; Thu, 23 Jan 2003 16:55:23 -0500 In-Reply-To: <20030123005530.GA808@ttnet.net.tr> Subject: Re: [PATCH] 2.5.59: ftruncate/truncate oopses with mandatory locking To: Faik Uygur Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com X-Mailer: Lotus Notes Release 6.0 September 26, 2002 Message-ID: From: "Robert Williamson" Date: Thu, 23 Jan 2003 17:04:16 -0500 X-MIMETrack: Serialize by Router on D01ML076/01/M/IBM(Release 5.0.11 +SPRs MIAS5EXFG4, MIAS5AUFPV and DHAG4Y6R7W, MATTEST |November 8th, 2002) at 01/23/2003 05:04:17 PM MIME-Version: 1.0 Content-type: multipart/mixed; Boundary="0__=0ABBE624DFEB50208f9e8a93df938690918c0ABBE624DFEB5020" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --0__=0ABBE624DFEB50208f9e8a93df938690918c0ABBE624DFEB5020 Content-type: text/plain; charset=us-ascii >This patch fixes the truncate/ftruncate oopses with mandatory locking >enabled. The problem with ftruncate is that the local variable fl is >not initialized properly in locks_mandatory_area that it misbehaves at >various places like locks_insert_block. And the problem with truncate >is that the filp variable is NULL at posix_lock_file. The NULL value >comes from do_sys_truncate. > locks_mandatory_area needed a bit more tweaking to allow correct error handling, as well as adherence to the O_NONBLOCK flag if/when used. Merged the original patch with my updates, and updated the bug report. >The bug report and details can be found at, >http://bugme.osdl.org/show_bug.cgi?id=280 - Robbie Robert V. Williamson Linux Test Project IBM Linux Technology Center Phone: (512) 838-9295 T/L: 678-9295 Fax: (512) 838-4603 Web: http://ltp.sourceforge.net IRC: #ltp on freenode.irc.net ==================== "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -Albert Einstein (See attached file: bug280.patch) --0__=0ABBE624DFEB50208f9e8a93df938690918c0ABBE624DFEB5020 Content-type: application/octet-stream; name="bug280.patch" Content-Disposition: attachment; filename="bug280.patch" Content-transfer-encoding: base64 LS0tIGxpbnV4LTIuNS41OS1vcmlnL2ZzL2xvY2tkL3N2Y2xvY2suYwlUaHUgSmFuIDE2IDIwOjIx OjQ5IDIwMDMKKysrIGxpbnV4LTIuNS41OS1uZXcvZnMvbG9ja2Qvc3ZjbG9jay5jCVRodSBKYW4g MjMgMTY6MzI6MTYgMjAwMwpAQCAtMzE1LDcgKzMxNSw3IEBACiAKIGFnYWluOgogCWlmICghKGNv bmZsb2NrID0gcG9zaXhfdGVzdF9sb2NrKCZmaWxlLT5mX2ZpbGUsICZsb2NrLT5mbCkpKSB7Ci0J CWVycm9yID0gcG9zaXhfbG9ja19maWxlKCZmaWxlLT5mX2ZpbGUsICZsb2NrLT5mbCk7CisJIAkJ ZXJyb3IgPSBwb3NpeF9sb2NrX2ZpbGUoZmlsZS0+Zl9maWxlLmZfZGVudHJ5LT5kX2lub2RlLCAm bG9jay0+ZmwpOwogCiAJCWlmIChibG9jaykKIAkJCW5sbXN2Y19kZWxldGVfYmxvY2soYmxvY2ss IDApOwpAQCAtNDE5LDcgKzQxOSw3IEBACiAJbmxtc3ZjX2NhbmNlbF9ibG9ja2VkKGZpbGUsIGxv Y2spOwogCiAJbG9jay0+ZmwuZmxfdHlwZSA9IEZfVU5MQ0s7Ci0JZXJyb3IgPSBwb3NpeF9sb2Nr X2ZpbGUoJmZpbGUtPmZfZmlsZSwgJmxvY2stPmZsKTsKKwllcnJvciA9IHBvc2l4X2xvY2tfZmls ZShmaWxlLT5mX2ZpbGUuZl9kZW50cnktPmRfaW5vZGUsICZsb2NrLT5mbCk7CiAKIAlyZXR1cm4g KGVycm9yIDwgMCk/IG5sbV9sY2tfZGVuaWVkX25vbG9ja3M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ZXh0ZXJuIHN0cnVjdCBmaWxlX2xvY2sgKnBvc2l4X3Rlc3RfbG9jayhzdHJ1Y3QgZmlsZSAqLCBz dHJ1Y3QgZmlsZV9sb2NrICopOwotZXh0ZXJuIGludCBwb3NpeF9sb2NrX2ZpbGUoc3RydWN0IGZp bGUgKiwgc3RydWN0IGZpbGVfbG9jayAqKTsKK2V4dGVybiBpbnQgcG9zaXhfbG9ja19maWxlKHN0 cnVjdCBpbm9kZSAqLCBzdHJ1Y3QgZmlsZV9sb2NrICopOwogZXh0ZXJuIHZvaWQgcG9zaXhfYmxv Y2tfbG9jayhzdHJ1Y3QgZmlsZV9sb2NrICosIHN0cnVjdCBmaWxlX2xvY2sgKik7CiBleHRlcm4g dm9pZCBwb3NpeF91bmJsb2NrX2xvY2soc3RydWN0IGZpbGUgKiwgc3RydWN0IGZpbGVfbG9jayAq KTsKIGV4dGVybiBpbnQgcG9zaXhfbG9ja3NfZGVhZGxvY2soc3RydWN0IGZpbGVfbG9jayAqLCBz dHJ1Y3QgZmlsZV9sb2NrICopOwo= --0__=0ABBE624DFEB50208f9e8a93df938690918c0ABBE624DFEB5020-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/