From patchwork Thu Jul 11 01:17:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2825967 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE6319F756 for ; Thu, 11 Jul 2013 01:17:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F1FE2012D for ; Thu, 11 Jul 2013 01:17:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC90420121 for ; Thu, 11 Jul 2013 01:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569Ab3GKBRi (ORCPT ); Wed, 10 Jul 2013 21:17:38 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:33706 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754046Ab3GKBRh (ORCPT ); Wed, 10 Jul 2013 21:17:37 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so7231997pbb.8 for ; Wed, 10 Jul 2013 18:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:x-priority:x-guid:x-has-attach :x-mailer:mime-version:message-id:content-type :content-transfer-encoding; bh=Kd6I6tMd4MiSk/HM4npO5RLIvjfLJGKi95gTDSCkIeg=; b=CU8YJTtf0A5ZNvPlhZUgw+ig7owdyMMEIu1i0b8C1SUuj6m9FDnVVs1iXjBTMJU2Vr wzKDARD++QBbFZ/v69JpiyXwzaBgadf+WHid4vzUbTyB9sSW33177s1IIb18df+pVPUq biaN0/M3+xRwQ8pyD80dUClq5+nrYqRzF9y8Mhcv2WrESXIYPlIhqEnJeMEL1ffRbsu/ 7KQ6k79hLWbVWjYOyZ6QvjCCa2LvtjqdElPeqTqNqvTDbYXRdlvTkH09ZcOCIv3Uj7Ci LHsWz5wlku12KYPG2VMUa4Yd1OtrrEpddQkmEyUUC6Kir/tAMG4P6ky7a0SbjiWXCEhO hXKQ== X-Received: by 10.68.218.132 with SMTP id pg4mr12055975pbc.200.1373505457224; Wed, 10 Jul 2013 18:17:37 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id qu10sm36548564pbb.12.2013.07.10.18.17.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Jul 2013 18:17:36 -0700 (PDT) Date: Thu, 11 Jul 2013 09:17:18 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH] ceph:Update the file time after mmap-write. X-Priority: 3 X-GUID: 3A459F14-8445-45C8-A410-717B851F90FB X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201307110917146231510@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Although, mmap-write of ceph update the time of file using file_update_time.Because it don't mark the relative cap so the time can't save. Signed-off-by: Jianpeng Ma --- fs/ceph/addr.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 1.8.1.2 diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 38b5c1b..52f7c7c 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1231,10 +1231,18 @@ static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ret = ceph_update_writeable_page(vma->vm_file, off, len, page); if (ret == 0) { + int dirty; + struct ceph_inode_info *ci = ceph_inode(inode); /* success. we'll keep the page locked. */ set_page_dirty(page); up_read(&mdsc->snap_rwsem); ret = VM_FAULT_LOCKED; + + spin_lock(&ci->i_ceph_lock); + dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); + spin_unlock(&ci->i_ceph_lock); + if (dirty) + __mark_inode_dirty(inode, dirty); } else { if (ret == -ENOMEM) ret = VM_FAULT_OOM;