From patchwork Wed Jul 18 11:04:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10532165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CF2C6020A for ; Wed, 18 Jul 2018 11:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 217A329092 for ; Wed, 18 Jul 2018 11:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 160242909F; Wed, 18 Jul 2018 11:05:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B079C29092 for ; Wed, 18 Jul 2018 11:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730238AbeGRLnA (ORCPT ); Wed, 18 Jul 2018 07:43:00 -0400 Received: from mout.gmx.net ([212.227.15.15]:40403 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729233AbeGRLnA (ORCPT ); Wed, 18 Jul 2018 07:43:00 -0400 Received: from localhost.localdomain ([220.112.58.66]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MGj8j-1fsggv2xgf-00DZlF; Wed, 18 Jul 2018 13:05:33 +0200 From: Chengguang Xu To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, idryomov@gmail.com, Chengguang Xu Subject: [PATCH 5/5] ceph: compare fsc->max_file_size and inode->i_size for max file size limit Date: Wed, 18 Jul 2018 19:04:27 +0800 Message-Id: <20180718110427.7775-6-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180718110427.7775-1-cgxu519@gmx.com> References: <20180718110427.7775-1-cgxu519@gmx.com> X-Provags-ID: V03:K1:fATllhTwCZEuXS8ByuYpYGMHioyEs2eYd6f6i3HnA/D2QwD5UMd lp7bri/3dzdMe2dQ5R8oTMI0xyLjQYIlNqmfFSsRZYF4GLzXzdqc6Kq15nad3fm1Wp/eeHv Xt53EKS1Y5y6WsRZYQALa8cej+v55r+wDpnNNutvMY/nVW+vHCr+E45RwIKU5p/lEUC7LHb MRrA5ruRfpw53D37YhtdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:aaVVuZpE0Gs=:GlLcXDmZ23+mBaxu0LVDaR P0/7b9+DRo7nKxPO2fg0hbleNTjRCOZeH4bxHlC/7Oa0RMTCn10DFn4NcHMmAtaZ2PSPzHUnI D7/tOtf2dIvLhmyGXHfDNlSZWAVcFnGCo7rjSrKMtRWhrDdpDtO+sUqngVydcjjEkYIQ8cfXH trF51iglG7Bus2EQxrt4CViMqQ6TJKcC0cbEnxpzvtB0If7Ht9P9eSARLCpfb96UJiOA4iI0n U+WPLJSB1soZRVr1uE5gc8/FFwREiI3EOPf1kVbrohsVn0dxSloIKUXS0YA25aY9DQFdrp5xx 3ph4nK7O4vxrpc4c5fYImHquY+q05wh6uU+o/RTNofABWywrvhFbZxh6vyrkYJ08Poz2QFhD6 jAKkF9J0TQX8W5saeLFFHGWL0GDWq87TVhhRoCzKF5Vficeayu3XNE3OCDB26xj1OzYhEm9R1 Do2d9nnnWFs0ww2JMTWisK4hZURmHWaw5OSZFwcWe1mtgF+5xpNIagoGxFn/Jm/sXTn8+CF8E NJ84QcU/QN+hZwpexnCHZ1pjIgTcEHgCus3Q/4XdBtfulSHSJdHm0t1YC7ERQwSojlg2IVxNq udAwZ5euBPcE/Wvhg1wP0fh6XNk1J/czizLau7qW21W4iAcBfPA707rH8mD2Zj44hb+qgj1S0 MeVEuZhTnyjB+7q9WAuf9T+5cW+Z4H0cJUtglgdYw7sLO5kUdlQtvMaGelCRbim/9ShaY1/2z EW6s2zhOTz3uwrn4ALfuo0LWoxwwwhH4udzwtuU9+iGR2nz6m167ctIuKxA= Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In ceph_llseek(), we compare fsc->max_file_size and inode->i_siz to choose max file size limit. Signed-off-by: Chengguang Xu --- fs/ceph/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 23b30cf8caf4..3df0dd22b6ed 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1564,8 +1564,10 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; + struct ceph_fs_client *fsc = inode->i_sb->s_fs_info; loff_t i_size; loff_t ret; + loff_t limit; inode_lock(inode); @@ -1608,7 +1610,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) break; } - ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); + limit = max(i_size, fsc->max_file_size); + ret = vfs_setpos(file, offset, limit); out: inode_unlock(inode);