mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Becker <joel.becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Cc: linux-kernel@vger.kernel.org, mfasheh@suse.com
Subject: [PATCH 09/11] ocfs2_dlmfs: Don't honor truncate.  The size of a dlmfs file is LVB_LEN
Date: Wed, 10 Feb 2010 01:27:52 -0800	[thread overview]
Message-ID: <1265794074-19539-10-git-send-email-joel.becker@oracle.com> (raw)
In-Reply-To: <1265794074-19539-1-git-send-email-joel.becker@oracle.com>

We want folks using dlmfs to be able to use the LVB in places other than
just write(2)/read(2).  By ignoring truncate requests, we allow 'echo
"contents" > /dlm/space/lockname' to work.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
---
 fs/ocfs2/dlmfs/dlmfs.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index e21ce0e..13ac2bf 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -220,6 +220,23 @@ static int dlmfs_file_release(struct inode *inode,
 	return 0;
 }
 
+/*
+ * We do ->setattr() just to override size changes.  Our size is the size
+ * of the LVB and nothing else.
+ */
+static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr)
+{
+	int error;
+	struct inode *inode = dentry->d_inode;
+
+	attr->ia_valid &= ~ATTR_SIZE;
+	error = inode_change_ok(inode, attr);
+	if (!error)
+		error = inode_setattr(inode, attr);
+
+	return error;
+}
+
 static unsigned int dlmfs_file_poll(struct file *file, poll_table *wait)
 {
 	int event = 0;
@@ -634,6 +651,7 @@ static const struct super_operations dlmfs_ops = {
 
 static const struct inode_operations dlmfs_file_inode_operations = {
 	.getattr	= simple_getattr,
+	.setattr	= dlmfs_file_setattr,
 };
 
 static int dlmfs_get_sb(struct file_system_type *fs_type,
-- 
1.6.6.1


  parent reply	other threads:[~2010-02-10  9:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  9:27 [0/11] ocfs2_dlmfs improvements v2 Joel Becker
2010-02-10  9:27 ` [PATCH 01/11] ocfs2_dlmfs: Add capabilities parameter Joel Becker
2010-02-11 20:41   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 02/11] ocfs2_dlmfs: Use poll() to signify BASTs Joel Becker
2010-02-10  9:27 ` [PATCH 03/11] ocfs2_dlmfs: Move to its own directory Joel Becker
2010-02-11 21:12   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 04/11] ocfs2: Pass lksbs back from stackglue ast/bast functions Joel Becker
2010-02-11 21:20   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 05/11] ocfs2: Attach the connection to the lksb Joel Becker
2010-02-12 23:57   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 06/11] ocfs2: Hang the locking proto on the cluster conn and use it in asts Joel Becker
2010-02-12 23:59   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 07/11] ocfs2: Remove the ast pointers from ocfs2_stack_plugins Joel Becker
2010-02-13  1:10   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 08/11] ocfs2: Pass the locking protocol into ocfs2_cluster_connect() Joel Becker
2010-02-27  0:09   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` Joel Becker [this message]
2010-02-27  0:11   ` [Ocfs2-devel] [PATCH 09/11] ocfs2_dlmfs: Don't honor truncate. The size of a dlmfs file is LVB_LEN Sunil Mushran
2010-02-10  9:27 ` [PATCH 10/11] ocfs2_dlmfs: Use the stackglue Joel Becker
2010-02-27  0:27   ` [Ocfs2-devel] " Sunil Mushran
2010-02-10  9:27 ` [PATCH 11/11] ocfs2_dlmfs: Enable the use of user cluster stacks Joel Becker
2010-03-02  0:08   ` [Ocfs2-devel] " Sunil Mushran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1265794074-19539-10-git-send-email-joel.becker@oracle.com \
    --to=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®