Commit:     22dd483721939b4ea22d5d3925e69112f63c42bc
Parent:     b88629060b03adc58639f818fe0968bf5fe81b5d
Author:     Jan Kara <[EMAIL PROTECTED]>
AuthorDate: Sat Dec 22 14:03:25 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Dec 23 12:54:36 2007 -0800

    Fix computation of SKB size for quota messages
    Fix computation of size of skb needed for quota message.  We should use
    netlink provided functions and not just an ad-hoc number.  Also don't print
    the return value from nla_put_foo() as it is always -1.
    Signed-off-by: Jan Kara <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 fs/dquot.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/dquot.c b/fs/dquot.c
index 686ab63..b2592ab 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -895,9 +895,6 @@ out_lock:
-/* Size of quota netlink message - actually an upperbound for buffer size */
-#define QUOTA_NL_MSG_SIZE 32
 /* Netlink family structure for quota */
 static struct genl_family quota_genl_family = {
        .id = GENL_ID_GENERATE,
@@ -914,11 +911,13 @@ static void send_warning(const struct dquot *dquot, const 
char warntype)
        struct sk_buff *skb;
        void *msg_head;
        int ret;
+       int msg_size = 4 * nla_total_size(sizeof(u32)) +
+                      2 * nla_total_size(sizeof(u64));
        /* We have to allocate using GFP_NOFS as we are called from a
         * filesystem performing write and thus further recursion into
         * the fs to free some data could cause deadlocks. */
-       skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS);
+       skb = genlmsg_new(msg_size, GFP_NOFS);
        if (!skb) {
                  "VFS: Not enough memory to send quota warning.\n");
@@ -959,7 +958,7 @@ static void send_warning(const struct dquot *dquot, const 
char warntype)
                        "VFS: Failed to send notification message: %d\n", ret);
-       printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret);
+       printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to