From patchwork Thu Sep 27 18:06:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Schutt X-Patchwork-Id: 1515331 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1B2EDE00FF for ; Thu, 27 Sep 2012 18:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752715Ab2I0SHJ (ORCPT ); Thu, 27 Sep 2012 14:07:09 -0400 Received: from sentry-two.sandia.gov ([132.175.109.14]:37571 "EHLO sentry-two.sandia.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752220Ab2I0SHI (ORCPT ); Thu, 27 Sep 2012 14:07:08 -0400 X-WSS-ID: 0MB0SZP-0B-2IH-02 X-M-MSG: Received: from interceptor1.sandia.gov (interceptor1.sandia.gov [132.175.109.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by sentry-two.sandia.gov (Postfix) with ESMTP id 15908D2C695 for ; Thu, 27 Sep 2012 12:07:00 -0600 (MDT) Received: from sentry.sandia.gov (mm04snlnto.sandia.gov [132.175.109.21]) by interceptor1.sandia.gov (RSA Interceptor) for ; Thu, 27 Sep 2012 12:06:54 -0600 Received: from [132.175.109.1] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.2)); Thu, 27 Sep 2012 12:06:35 -0600 X-Server-Uuid: 6BFC7783-7E22-49B4-B610-66D6BE496C0E Received: from skynetrps1.sandia.gov (skynetrps1.sandia.gov [134.253.138.1]) by mailgate.sandia.gov (8.14.4/8.14.4) with ESMTP id q8RI6WX4007836; Thu, 27 Sep 2012 12:06:32 -0600 From: "Jim Schutt" To: ceph-devel@vger.kernel.org cc: "Jim Schutt" Subject: [PATCH] FileJournal: correctly check return value of lseek in write_fd Date: Thu, 27 Sep 2012 12:06:29 -0600 Message-ID: <1348769189-140200-1-git-send-email-jaschut@sandia.gov> X-Mailer: git-send-email 1.7.8.2 X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.9.27.175726 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_700_799 0, DATE_TZ_NA 0, __ANY_URI 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' X-TMWD-Spam-Summary: TS=20120927180636; ID=1; SEV=2.3.1; DFV=B2012092717; IFV=NA; AIF=B2012092717; RPD=5.03.0010; ENG=NA; RPDID=7374723D303030312E30413031303230322E35303634393541432E303031393A534346535441543838363133332C73733D312C6667733D30; CAT=NONE; CON=NONE; SIG=AAAAAAAAAAAAAAAAAAAAAAAAfQ== X-MMS-Spam-Filter-ID: B2012092717_5.03.0010 MIME-Version: 1.0 X-WSS-ID: 7C7A4A2143C2158464-01-01 X-RSA-Inspected: yes X-RSA-Classifications: public X-RSA-Action: allow Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Signed-off-by: Jim Schutt --- src/os/FileJournal.cc | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index d1c92dc..2254720 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -945,9 +945,10 @@ void FileJournal::align_bl(off64_t pos, bufferlist& bl) int FileJournal::write_bl(off64_t& pos, bufferlist& bl) { align_bl(pos, bl); + int ret; - int ret = ::lseek64(fd, pos, SEEK_SET); - if (ret) { + off64_t spos = ::lseek64(fd, pos, SEEK_SET); + if (spos < 0) { ret = -errno; derr << "FileJournal::write_bl : lseek64 failed " << cpp_strerror(ret) << dendl; return ret;